Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assembleRelease with hermes crashes #26022

Closed
heroic opened this issue Aug 11, 2019 · 5 comments
Closed

assembleRelease with hermes crashes #26022

heroic opened this issue Aug 11, 2019 · 5 comments
Labels
Bug Platform: Linux Building on Linux. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@heroic
Copy link

heroic commented Aug 11, 2019

When running gradle assembleRelease in a docker container, hermes dies while compiling JS. Log is attached:

Stack dump:
0.      Program arguments: ../../node_modules/hermesvm/linux64-bin/hermes -emit-binary -out /home/jenkins/android/app/build/generated/assets/react/release/index.android.bundle /home/jenkins/android/app/build/generated/assets/react/release/index.android.bundle -O -output-source-map 
1.      Program arguments: ../../node_modules/hermesvm/linux64-bin/hermes -emit-binary -out /home/jenkins/android/app/build/generated/assets/react/release/index.android.bundle /home/jenkins/android/app/build/generated/assets/react/release/index.android.bundle -O -output-source-map 
[0x41ba83]
[0x41abc9]
[0x41ac6c]
[0x4265e0]
[0x499f43]
[0x49a163]
[0x43d7ff]
[0x43d967]
[0x44003a]
[0x4399b2]
[0x439b32]
[0x42b8b9]
[0x4308d6]
[0x40487b]
[0x712f34]
[0x7131b1]
[0x408116]
[0x41ba83]
[0x41abc9]
[0x41ac6c]
[0x4265e0]
[0x499f43]
[0x49a163]
[0x43d7ff]
[0x43d967]
[0x44003a]
[0x4399b2]
[0x439b32]
[0x42b8b9]
[0x4308d6]
[0x40487b]
[0x712f34]
[0x7131b1]
[0x408116]

> Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* Where:
Script '/home/jenkins/node_modules/react-native/react.gradle' line: 142

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command '../../node_modules/hermesvm/linux64-bin/hermes'' finished with non-zero exit value 135

React Native version:

System:
    OS: Linux 4.9 Ubuntu 18.04.2 LTS (Bionic Beaver)
    CPU: (2) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
    Memory: 1.05 GB / 1.95 GB
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 8.16.0 - /usr/bin/node
    Yarn: 1.17.3 - /usr/bin/yarn
    npm: 6.4.1 - /usr/bin/npm
  SDKs:
    Android SDK:
      API Levels: 28
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom_64
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4

Steps To Reproduce

FROM ubuntu:18.04

ENV TOOL_VER_RUBY="2.6.3" \
  ANDROID_HOME="/opt/android-sdk-linux" \
  QT_QPA_PLATFORM="offscreen"

ENV PATH="${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:/usr/local/gradle/bin" \
  LD_LIBRARY_PATH="${ANDROID_HOME}/tools/lib64:${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib"

COPY adbkey adbkey.pub adb_usb.ini /root/.android/

RUN apt-get update -qq \
  && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y locales \
  && locale-gen en_US.UTF-8 \
  && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install gpg-agent git curl wget build-essential unzip software-properties-common zlib1g-dev libssl-dev libreadline6-dev libyaml-dev libsqlite3-dev \
  && mkdir -p /tmp/ruby-inst \
  && cd /tmp/ruby-inst \
  && wget -q https://cache.ruby-lang.org/pub/ruby/2.6/ruby-${TOOL_VER_RUBY}.tar.gz -O ruby-${TOOL_VER_RUBY}.tar.gz \
  && tar -xvzf ruby-${TOOL_VER_RUBY}.tar.gz \
  && cd ruby-${TOOL_VER_RUBY} \
  && ./configure --prefix=/usr/local && make && make install \
  # cleanup
  && cd / \
  && rm -rf /tmp/ruby-inst \
  && gem update --system --no-document \
  && gem update bundler --no-document -f \
  && apt-get install -y --no-install-recommends  \
  && curl -sL https://deb.nodesource.com/setup_8.x | bash \
  && DEBIAN_FRONTEND=noninteractive apt-get update -qq \
  && apt-get install -y --no-install-recommends nodejs \
  && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
  && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
  && DEBIAN_FRONTEND=noninteractive apt-get update -qq \
  && apt-get install -y --no-install-recommends yarn \
  && dpkg --add-architecture i386 \
  && apt-get update -qq \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-8-jdk libc6:i386 libstdc++6:i386 libgcc1:i386 libncurses5:i386 libz1:i386 \
  && cd /opt \
  && wget -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip -O android-sdk-tools.zip \
  && unzip -q android-sdk-tools.zip -d ${ANDROID_HOME} \
  && rm android-sdk-tools.zip \
  && cd /usr/local/ \
  && wget https://services.gradle.org/distributions/gradle-5.1.1-all.zip \
  && unzip gradle-5.1.1-all.zip && rm gradle-5.1.1-all.zip && mv gradle-5.1.1 gradle \
  && gem install fastlane --no-document \
  && fastlane --version \
  && DEBIAN_FRONTEND=noninteractive apt-get install -y libqt5widgets5 \
  && apt-get -yq autoremove \
  && apt-get clean \
  && apt-get autoclean \
  && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN yes | sdkmanager --licenses \
  && touch ~/.android/repositories.cfg \
  && sdkmanager "emulator" "tools" "platform-tools" \
  && yes | sdkmanager \
    "platforms;android-28" \
    "build-tools;29.0.2" \
    "system-images;android-28;google_apis;x86_64" \
    "extras;android;m2repository" \
    "extras;google;m2repository" \
    "extras;google;google_play_services" \
    "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2" \
    "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1"
RUN echo 'no' | avdmanager create avd -n "Nexus_6_28" -d "Nexus 6" --package 'system-images;android-28;google_apis;x86_64' --tag google_apis

COPY config.ini /root/.android/avd/x86.avd/config.ini

ENV DOCKER_VERSION 17.12.0
ENV EXPOSECONTROLLER_VERSION 2.3.34
ENV GCLOUD_VERSION 249.0.0
ENV HELM_VERSION 2.14.1
ENV JX_RELEASE_VERSION 1.0.17
ENV SKAFFOLD_VERSION 0.31.0
ENV CONTAINER_STRUCTURE_TEST_VERSION 1.8.0
ENV UPDATEBOT_VERSION 1.1.41
ENV REFLEX_VERSION 0.3.1
ENV GORELEASER_VERSION 0.110.0

# USER jenkins
WORKDIR /home/jenkins

# Docker
RUN curl -f https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION-ce.tgz | tar xvz && \
  mv docker/docker /usr/bin/ && \
  rm -rf docker

# helm
RUN curl -f https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz  | tar xzv && \
  mv linux-amd64/helm /usr/bin/ && \
  mv linux-amd64/tiller /usr/bin/ && \
  rm -rf linux-amd64

# helm3
RUN curl -L https://get.helm.sh/helm-v3.0.0-alpha.1-linux-amd64.tar.gz | tar xzv && \
  mv linux-amd64/helm /usr/bin/helm3 && \
  rm -rf linux-amd64

RUN curl -f -L https://github.com/jstrachan/helm/releases/download/untagged-93375777c6644a452a64/helm-linux-amd64.tar.gz -o helm3.tgz && \
  tar xf helm3.tgz && \
  mv helm /usr/bin/helm3

RUN rm *.tgz

# gcloud
RUN apt-get update -qq && apt-get install -y --no-install-recommends python3 python3-dev python3-pip \
  && curl -f -L https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${GCLOUD_VERSION}-linux-x86_64.tar.gz | tar xzv && \
  mv google-cloud-sdk /usr/bin/
ENV PATH=$PATH:/usr/bin/google-cloud-sdk/bin

ENV CLOUDSDK_PYTHON="/usr/bin/python3"

# install the docker credential plugin
RUN gcloud components install docker-credential-gcr

# jx-release-version
RUN curl -f -o ./jx-release-version -L https://github.com/jenkins-x/jx-release-version/releases/download/v${JX_RELEASE_VERSION}/jx-release-version-linux && \
  mv jx-release-version /usr/bin/ && \
  chmod +x /usr/bin/jx-release-version

# exposecontroller
RUN curl -f -L https://github.com/fabric8io/exposecontroller/releases/download/v$EXPOSECONTROLLER_VERSION/exposecontroller-linux-amd64 > exposecontroller && \
  chmod +x exposecontroller && \
  mv exposecontroller /usr/bin/

# skaffold
RUN curl -f -Lo skaffold https://storage.googleapis.com/skaffold/releases/v${SKAFFOLD_VERSION}/skaffold-linux-amd64 && \
  chmod +x skaffold && \
  mv skaffold /usr/bin

# container structure test
RUN curl -LO https://storage.googleapis.com/container-structure-test/v${CONTAINER_STRUCTURE_TEST_VERSION}/container-structure-test-linux-amd64 && \
   chmod +x container-structure-test-linux-amd64 && \
   mv container-structure-test-linux-amd64 /usr/local/bin/container-structure-test

# updatebot
RUN curl -f  -o ./updatebot -L https://oss.sonatype.org/content/groups/public/io/jenkins/updatebot/updatebot/${UPDATEBOT_VERSION}/updatebot-${UPDATEBOT_VERSION}.jar && \
  chmod +x updatebot && \
  cp updatebot /usr/bin/ && \
  rm -rf updatebot

# draft
RUN curl -f https://azuredraft.blob.core.windows.net/draft/draft-canary-linux-amd64.tar.gz  | tar xzv && \
  mv linux-amd64/draft /usr/bin/ && \
  rm -rf linux-amd64

# kubectl
RUN curl -f -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
  chmod +x kubectl && \
  mv kubectl /usr/bin/

# aws ecr docker credential helper.
# Currently using https://github.com/estahn/amazon-ecr-credential-helper as there are no releases yet in the main repo
# Main repo issues tracking at https://github.com/awslabs/amazon-ecr-credential-helper/issues/80
RUN mkdir ecr && \
    curl -f -L https://github.com/estahn/amazon-ecr-credential-helper/releases/download/v0.1.1/amazon-ecr-credential-helper_0.1.1_linux_amd64.tar.gz | tar -xzv -C ./ecr/ && \
    mv ecr/docker-credential-ecr-login /usr/bin/ && \
    rm -rf ecr

# ACR docker credential helper
#??https://github.com/Azure/acr-docker-credential-helper
RUN mkdir acr && \
    curl -f -L https://aadacr.blob.core.windows.net/acr-docker-credential-helper/docker-credential-acr-linux-amd64.tar.gz | tar -xzv -C ./acr/ && \
    mv acr/docker-credential-acr-linux /usr/bin/ && \
    rm -rf acr
    
# reflex
RUN curl -f -L https://github.com/ccojocar/reflex/releases/download/v${REFLEX_VERSION}/reflex_${REFLEX_VERSION}_linux_amd64.tar.gz | tar xzv && \
  mv reflex /usr/bin/

# goreleaser
RUN mkdir goreleaser && \
    curl -Lf https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_Linux_x86_64.tar.gz | tar -xzv -C ./goreleaser/ && \
    mv goreleaser/goreleaser /usr/bin/ && \
    rm -rf goreleaser

ENV PATH ${PATH}:/opt/google/chrome

CMD ["helm","version"]
  1. Use the dockerfile above.
  2. Create a new react native project
  3. Run gradle assembleRelease
  4. Build crashes

Describe what you expected to happen:

gradle should finish running.

@heroic heroic added the Bug label Aug 11, 2019
@react-native-bot react-native-bot added the Platform: Linux Building on Linux. label Aug 11, 2019
@microcai
Copy link

also crash on windows

@heroic
Copy link
Author

heroic commented Aug 12, 2019

So a bit of testing shows this is where the build dies (react.gradle.)

commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, jsBundleFile, *hermesFlags)

@andreasbergqvist
Copy link

My fix:
#25599 (comment)

I only tested it on windows, but since there are updates that are coming for react native 0.61, I guess its worth trying.

@stale
Copy link

stale bot commented Nov 22, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 22, 2019
@stale
Copy link

stale bot commented Nov 29, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Nov 29, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Nov 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Linux Building on Linux. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants