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

Out of memory for release builds #996

Closed
barbeau opened this issue Jul 10, 2019 · 4 comments
Closed

Out of memory for release builds #996

barbeau opened this issue Jul 10, 2019 · 4 comments
Labels
Milestone

Comments

@barbeau
Copy link
Member

barbeau commented Jul 10, 2019

Summary:

I'm having issues with out of memory issues for release builds - they seem to be triggered by a change in Gradle 5.1:
gradle/gradle#7746

Here are the docs for changing memory settings for Gradle:
https://docs.gradle.org/current/userguide/build_environment.html#sec:configuring_jvm_memory

Steps to reproduce:

Run gradlew assembleRelease

Expected behavior:

Successfully build a release

Observed behavior:

Various out of memory errors, such as:

E:\Android_Studio\onebusaway-android>gradlew assembleRelease --scan
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :onebusaway-android
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :onebusaway-android:processAgencyXAmazonReleaseGoogleServices
Parsing json file: E:\Android_Studio\onebusaway-android\onebusaway-android\google-services.json

> Task :onebusaway-android:processAgencyXAmazonReleaseManifest
E:\Android_Studio\onebusaway-android\onebusaway-android\src\amazon\AndroidManifest.xml:24:9-31:50 Warning:
        activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other de
clarations but no other declaration present

> Task :onebusaway-android:compileAgencyXAmazonReleaseKotlin
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/barbeau/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.3.41/a1f331124ba069a09e964ad2640c36f140f2c758/kotlin
-stdlib-jdk7-1.3.41.jar (version 1.3)
    C:/Users/barbeau/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jre7/1.1.51/8b5933578dc55f32cfc1a25f1db6371e4161fb8f/kotlin
-stdlib-jre7-1.1.51.jar (version 1.1)
    C:/Users/barbeau/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.3.41/e24bd38de28a326cce8b1f0d61e809e9a92dad6a/kotlin-stdl
ib-1.3.41.jar (version 1.3)
    C:/Users/barbeau/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.3.41/2ecf4aa059427d7186312fd1736afedf7972e7f7/kotl
in-stdlib-common-1.3.41.jar (version 1.3)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
w: C:\Users\barbeau\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jre7\1.1.51\8b5933578dc55f32cfc1a25f1db6371e4161fb8f\kotlin-
stdlib-jre7-1.1.51.jar: kotlin-stdlib-jre7 is deprecated. Please use kotlin-stdlib-jdk7 instead

> Task :onebusaway-android:compileAgencyXAmazonReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :onebusaway-android:lintVitalAgencyXAmazonRelease
Calling mockable JAR artifact transform to create file: C:\Users\barbeau\.gradle\caches\transforms-2\files-2.1\738a4c89d12f7ece1a064dc3b87771bd\androi
d.jar with input C:\Users\barbeau\AppData\Local\Android\sdk\platforms\android-29\android.jar

> Task :onebusaway-android:transformClassesAndResourcesWithR8ForAgencyXAmazonRelease
R8 is the new Android code shrinker. If you experience any issues, please file a bug at
https://issuetracker.google.com, using 'Shrinker (R8)' as component name. You can
disable R8 by updating gradle.properties with 'android.enableR8=false'.
Current version is: 1.4.94 (build 390954928f0db9c3b888a367f7f128ce3bbfb160 from go/r8bot (luci-r8-ci-archive-0-5g74)).


Expiring Daemon because JVM Tenured space is exhausted
Daemon will be stopped at the end of the build after running out of JVM memory
Expiring Daemon because JVM Tenured space is exhausted
Expiring Daemon because JVM Tenured space is exhausted
Expiring Daemon because JVM Tenured space is exhausted
Expiring Daemon because JVM Tenured space is exhausted
Expiring Daemon because JVM Tenured space is exhausted

> Task :onebusaway-android:transformClassesAndResourcesWithR8ForAgencyXAmazonRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':onebusaway-android:transformClassesAndResourcesWithR8ForAgencyXAmazonRelease'.
> GC overhead limit exceeded

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 3m 46s
25 actionable tasks: 25 executed
@barbeau barbeau added the bug label Jul 10, 2019
@barbeau barbeau added this to the v2.5.x milestone Jul 10, 2019
@barbeau
Copy link
Member Author

barbeau commented Jul 10, 2019

So it seems that having gradle.properties with:

org.gradle.jvmargs=-Xmx4g -Xms1g -XX:MaxPermSize=4g

...and running the build without the Gradle daemon is a workaround:

gradlew assembleRelease --no-daemon

@barbeau
Copy link
Member Author

barbeau commented Jul 11, 2019

When running in a daemon the memory config isn't being picked up - if I do the build with -scan on the end and look at the environment on scans.gradle.com, I see:

Max JVM memory heap size 491 MB

...even when using the following in gradle.properties:

org.gradle.jvmargs=-Xmx4g -Xms1g -XX:MaxPermSize=4g

@barbeau barbeau modified the milestones: v2.5, v2.6 Jul 11, 2019
@barbeau
Copy link
Member Author

barbeau commented Jul 12, 2019

This looks like a great reference for Gradle property settings:
https://medium.com/@wasyl/make-your-gradle-builds-fast-again-ea323ce6a435

@barbeau
Copy link
Member Author

barbeau commented Jul 12, 2019

So the reason why the previous gradle.properties change wasn't being picked up was that I was changing the file under onebusaway-android folder, not root 🤦. Moving it to root seems to have solved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant