Gradle daemon crashed when building with sonarqube

We’ve configured our project with Sonarqube on our yml file. Basically, we’ve encountered an issue with gradle daemon crash. Provided is the screenshot of our workflow.

With or without ./gradlew :app:assembleApiRelease --stacktrace line, ./gradlew build sonarqube --info throws the same error. See image below.

And here is our jvm args from gradle properties.

org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options=“-Xmx8192M” -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError

Your help is greatly appreciated. Thank you!

1 Like

Hey there.

Is there any more information regarding at what point in the build/analysis it crashes? Any INFO level log lines (or DEBUG if you switch logging to --debug)? If it’s not something obvious, let us know and I’ll open a private message where you can share.

Hi Colin, Can’t see anything obvious on the logs (both INFO and DEBUG). Can we have this on private message?

I’m getting out of memory exception on a large multi module gradle project, what are optimal setting for this to run within github actions? I couldn’t find out how to easily increase memory available in github actions. Thanks!

Hii!
this topic is 5 months old, but In our project we are having this problem.

Our project is an Android multi-module. Is quite big.

In some PR’s the daemon disappear, and there is no “logic” behind . I mean, can disappear also in Big PR’s, as in small ones.

Our config is:

org.gradle.jvmargs=-Xmx5g -XX:MaxPermSize=3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options=-Xmx5g

this Runs in a Github Runner: Ubuntu → 4 core and 16 Ram

Hey all.

I found this issue on Gradle’s side:

This part seemed important:

One of the key defaults set by Gradle is -XX:MaxMetaspaceSize=256m, which is required because this value is unbounded on the JDK by default, allowing the Gradle daemon to consume more and more native memory until it crashes.

This means that a user setting org.gradle.jvmargs=-Xmx4g can result in daemon crashes, unless the user knows that they must also add a -XX:MaxMetaspaceSize setting.

@Shudy To start – can you try adding -XX:MaxMetaspaceSize=256m?

1 Like

Thank you very much @Colin , I find it disconcerting as well as interesting, that the basic configurations are deleted just by modifying a parameter.

I’ll make these changes, and I’ll be monitoring the GithubActions to see that it doesn’t keep happening.

I will inform you in a few days/week

Thanks!

1 Like

I’m back!

@Colin , as promised, We are now testing in GithubActions this new param in our gradle.properties. And everything is working fine.

Due to the size of our project, the memory assigned is quite bigger than 256m, but, works perfect.

Thanks!

1 Like

Hey @Tom_Wilson and @jayarbautista – if you’re still out there, maybe you can give this a try! It worked for @Shudy (thanks for the follow-up! :heart:)

1 Like