Memory issue using Sonarqube with Gradle

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Developer Edition - Version 8.4.2 (build 36762)

Hello,

I’m trying to get Sonarqube running on a multi-project Gradle to automate tests with Jenkins.
After multiple attempts and research I finally managed to run an ESQL validation on each of my Gradle projects.

Here is the code of the Jenkins pipeline:

node {
stage(“checkout branch”) {
git branch: “xxxx”,
credentialsId: ‘GitlabCredentialsId’,
url: “xxxxx”
}

stage(‘SonarQube analysis’) {
bat ‘gradlew sonarqube -Dorg.gradle.java.home=“C:\Program Files\Java\jdk-11.0.3” -Dorg.gradle.jvmargs=-Xmx4096M’
}
}

After the execution, the memory used by the JVM is not released immediately (it is necessary to wait 3 hours for it to be released by the system).
I’m talking about more than 7Gb of memory.

I use a Wrapper Gradle version 6.1.1, I have other automated tasks on Jenkins which prevents me from using the ‘gradlew --stop’ command to free the memory because this command will cut all the Gradle daemons using the same version (6.1.1).

Have you ever encountered this kind of problem before?

Attachments:
Execution start at 14:21 and finish at 14:35.
The memory is in hold till 17h35.


Hi Arnaud,

Welcome to the community. While I would love to help, I struggle to see how this problem is specific or has anything to do with SonarQube? This seems exclusively a Gradle/Jenkins pipeline setup and configuration issue. The org.gradle.jvmargs sets the memory for the Gradle daemon process.

Cheers,
Daniel