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

Gradle build fails randomly #13683

Closed
jniebuhr opened this issue Apr 27, 2017 · 7 comments
Closed

Gradle build fails randomly #13683

jniebuhr opened this issue Apr 27, 2017 · 7 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jniebuhr
Copy link

Description

When building our react native app on our jenkins, the build sometimes just fails. It does that pretty randomly.

This is the log output from the build:

Starting process 'command 'node''. Working directory: /home/jenkins/workspace/ Command: node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --reset-cache --entry-file index.android.js --bundle-output /home/jenkins/workspace/android/app/build/intermediates/assets/release/index.android.bundle --assets-dest /home/jenkins/workspace/android/app/build/intermediates/res/merged/release
Successfully started process 'command 'node''
Scanning 605 folders for symlinks in /home/jenkins/workspace/node_modules (4ms)
Scanning 605 folders for symlinks in /home/jenkins/workspace/node_modules (4ms)
Loading dependency graph, done.
warning: the transform cache was reset.
# :app:bundleReleaseJsAndAssets FAILED
:app:bundleReleaseJsAndAssets (Thread[main,5,main]) completed. Took 2 mins 38.439 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'node'' finished with non-zero exit value 137
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 4 mins 18.872 secs
Stopped 0 compiler daemon(s).
script returned exit code 1

Reproduction Steps and Sample Code

./gradlew clean assembleRelease

Additional Information

  • React Native version: 0.42.3
  • Platform: Android
  • Development Operating System: Debian GNU/Linux 8 (jessie)
  • Dev tools: Android Build Tools 25.0.2, Node v7.7.3, NPM 4.1.2, Gradle 2.14.1
@zenyr
Copy link

zenyr commented May 2, 2017

React packager randomly yet quite often dies while trying to watch files come and go blazing fast. I can restart react-native start but similar issue also happens while compiling. I'm not sure if 'react packager' is the only one crashing.
Sometimes it succeeds in a single pass, sometimes it soft-locks at certain step and requires ./gradlew clean before retrying.

@vspedr
Copy link

vspedr commented May 10, 2017

Same issue on Travis CI, RN version 0.32, build-tools 23.0.2

> Building 94% > :app:bundleReleaseJsAndAssets (11895ms)
> Building 94% > :app:bundleReleaseJsAndAssetsemory fs for JavaScript
> Building 94% > :app:bundleReleaseJsAndAssetsemory fs for JavaScript (372ms)
> Building 94% > :app:bundleReleaseJsAndAssetsemory fs for Assets
> Building 94% > :app:bundleReleaseJsAndAssetsemory fs for Assets (213ms)
> Building 94% > :app:bundleReleaseJsAndAssets> Building 94% > :app:bundleReleaseJsAndAssets> Building 94% > :app:bundleReleaseJsAndAssetss)
> Building 94% > :app:bundleReleaseJsAndAssetss)
> Building 94% > :app:bundleReleaseJsAndAssetss)
> Building 94% > :app:bundleReleaseJsAndAssetss)
> Building 94% > :app:bundleReleaseJsAndAssetsFAILED
> Building 94%FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'node'' finished with non-zero exit value 137

Is there any workaround?

@vspedr
Copy link

vspedr commented May 10, 2017

Hey @jniebuhr, I just found this:
https://discuss.gradle.org/t/gradle-travis-ci/11928/9

It seems that gradle gets killed due to lack of memory in the CI container, so I tried killing some unnecessary processes before running the build script. .travis.yml now looks like this:

before_install:
- nvm install 6
- node --version
- sudo service postgresql stop || true # kill unused services
- sudo service mysql stop || true
- sudo service memcached stop || true
- sudo service bootlogd stop || true
- sudo service elasticsearch stop || true
- sudo service mongodb stop || true
- sudo service neo4j stop || true
- sudo service cassandra stop || true
- sudo service riak stop || true
- sudo service rsync stop || true
- sudo service x11-common stop || true

Not sure how you could do that in jenkins, though.

@jniebuhr
Copy link
Author

We don't have any other services running in the jenkins container.
I'll check the memory limit though. The thing is that in our case the whole container would be killed if it hits the memory limit not the single process. Or is it somehow about the java memory limit for gradle?

@jniebuhr
Copy link
Author

Exit Code 137 basically means the underlying process has been killed with Signal 9, so a SIGKILL.

@jniebuhr
Copy link
Author

Seems to be the oom killer so I guess it isn't a react native issue.

@DylanVann
Copy link
Contributor

I wonder if doing react-native start as a separate command in parallel on CI might help with some of these errors.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants