OutOfMemoryError since moving to SonarQube Community Build 25.12.0.117093

Hello Daniel,

Thank you for providing the logs and your Jenkins configuration details.

I have reviewed the files, and at first glance, I don’t see anything obviously abnormal. While some files take quite a bit of time to analyze, this is generally expected for a codebase of this size.

However, I noticed that the file /src/main/java/jet/phoenix/ui/task/invoice/InputInvoiceNut3.java consistently appears at the very end of the logs.

Could you tell me if there is anything specific about this file? For example:

  • Is it exceptionally large or does it contain a very high number of methods/variables?

  • Is it auto-generated?

  • Does it have any “remarkable” or unique structural characteristics compared to the rest of the project?

Best regards,

Romain

Hello Romain,

Yes InputInvoiceNut3.java is a large file. Just under 6000 lines. No it is not auto-generated.

It has a lot of dependencies 300 lines of import.

Quite a few variables 200 lines (including some spacing).

SonarQube for IDE finds 61 issues in the class.

But I can not see any other unique structural characteristics.

It has also not seen any significant changes in the past 6 months. Mainly fixing sonarqube issues. And other local bug fixes, but nothing structural.

Kind regards,

Daniel

Hello Daniel,

Thank you for these additional details. Knowing the file size and the fact that it isn’t auto-generated is very helpful for my investigation.

To help me narrow this down further, would you be able to try running the analysis on this file alone? I’m curious to see if it still triggers the same memory error when isolated, or if the crash only occurs during the full project analysis.

Thank you for your help and your patience!

Best regards,

Romain

Hello Romain,

Thanks for your message.

When running the analysis on only InputInvoiceNut3.java I do not get the error.

I added -pl .,jet.phoenix.base to specifi only the module I want. And sonar.sources=src/main/java/jet/phoenix/ui/task/invoice/InputInvoiceNut3.java to limit to the single file.

Kind regards,

Daniel

Hello,

I have move to the latest version : Community Build v26.3.0.120487

The problem persists in the latest version.

Kind regards,

Daniel

Hello Daniel,

Thank you for these additional details. To get to the bottom of this, would you be open to sharing a heap dump (.hprof file) from a failed run?

Having that file is the most direct way for me to see exactly what is saturating the memory at that 99% mark.

Best regards,

Romain

Hello Romain,

No problem sharing a .hprof file. however I can not find such a file for the latest run. I am not certain where to tell java to create such a file.

We have added the following arguiment in the sonar.properties file :

sonar.ce.javaOpts=-Xmx4096m -Xms512m -XX:+HeapDumpOnOutOfMemoryError

We also have these arguments in the maven configuration in Jenkins :

sonar.java.opt=“-Xmx4G -Xms1G -XX:+HeapDumpOnOutOfMemoryError”
sonar.scanner.jvmOptions=“-Xmx4g -Xms1g -XX:+HeapDumpOnOutOfMemoryError”

When the job is being processed there are many system processes running so calling a command line command on each of these does not seem feasible.

Kind regards,

Daniel

Hello Daniel,

Could you try adding this flag to the MAVEN_OPTS environment variable in your Jenkins configuration?

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="${WORKSPACE}/sonar_analysis.hprof"

This should theoretically force the file into your Jenkins workspace root. I don’t use Jenkins myself, so I can’t assist much more with its specific interface or configuration, but once it crashes, you should hopefully be able to find and download the file from the “Workspace” section of the job.

If this doesn’t work as expected, I’d recommend searching the Jenkins documentation for “retrieving workspace files,” as my expertise with the platform is quite limited.

Best regards,

Romain

Hello Romain,

I have added the arguments and am running the test. Once I have got the memory dump how should I send it to you?

Kind regards,

Daniel

Hello Romain,

So far I am unable to get the hprof file to be produced. However in the last run I did get this message which seemed relevant :

[ERROR] [stderr] Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Report about progress of Java AST analyzer"

In the previous run that also failed I got this message :

[INFO] Did not optimize analysis for any files, performed a full analysis for all 7900 files.

I have added the file argument in the sonar.properties file as well. I am still struggling to figure out which process is running out of memory. So I am unsure if these dump file arguments are getting into the process in question. I say this as no process seems to reach the 4Gb limit set in these arguments.

Kind regards,

Daniel

Hello Romain,

I have attached the list of processes that contain the word sonar. This is the list just before the out of memory error.

SonarPS.txt (9.5 KB)

Possibly the process of interest is :

jenkins 1270443 245 29.1 7751156 4783924 ? Sl 22:57 51:15 /var/lib/jenkins/.sonar/cache/aeab55d064a1a27a3744b0880b9b414077b4ed2b1790817eea3df60aec946431/OpenJDK21U-jre_x64_linux_hotspot_21.0.9_10.tar.gz_extracted/jdk-21.0.9+10-jre/bin/java -Dorg.bouncycastle.pkcs12.ignore_useless_passwd=true -jar /var/lib/jenkins/.sonar/cache/6638ba85ce42e3932d84e2a6fa4e88da59fb6dc108749aa9079633593d82b651/sonar-scanner-engine-shaded-26.3.0.120487-all.jar

No evidence that this is the process. However it is the only one using a lot of memory.

Kind regards,

Daniel