which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension) - SonarQube Server Enterprise 2025.3
how is SonarQube deployed - Helm
what are you trying to achieve - Perform sonar analysis for a maven project
what have you tried so far to achieve this -
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
We have recently upgraded to SonarQube Server Enterprise 2025.3 and are experiencing memory issues (Exit Code: 137, Reason: OOMKilled) for some applications when running Maven Sonar analysis from a Jenkins Maven agent.
We have attempted to increase the Maven container memory limits and set the SONAR_SCANNER_JAVA_OPTS environment variable, but the scans still fail randomly for certain applications.
Could you please help how to fix this issue?
Please inform me if you require additional information such as logs, memory requests and limits, etc., so that I can share them privately.
This is a community forum that operates on transparency by default. See here..
I suggest you start by sharing some (redacted, if necessary) logs from around the time that the scanner crashes! That will give us a better idea of why it crashes, and maybe how to fix the issue.
I appreciate your response. Here are the logs from when the container crashed. The Sonar scan takes place in a Maven container that is initiated when a Jenkins job is triggered. Additionally, here are the requests and limits that have been set.
Logs:
[2025-06-20T13:33:38.875Z] [INFO] Written udg to file: /home/jenkins/agent/workspace/Snapshot_Pipeline_fix_sonarissue/target/sonar/architecture/js/___src_main_webapp_WEB-INF_templates_plugins_amcharts_plugins_export_lang_cs_js.udg
[2025-06-20T13:33:39.131Z] [DEBUG] Analyzing file "/home/jenkins/agent/workspace/Snapshot_Pipeline_fix_sonarissue/src/main/webapp/WEB-INF/templates/plugins/datepicker/locales/bootstrap-datepicker.no.js"
[2025-06-20T13:33:39.387Z] [DEBUG] Parsing /home/jenkins/agent/workspace/Snapshot_Pipeline_fix_sonarissue/src/main/webapp/WEB-INF/templates/plugins/datepicker/locales/bootstrap-datepicker.no.js with typescript-eslint/parser
[2025-06-20T13:33:41.280Z] [DEBUG] Cache entry created for key 'jssecurity:ucfgs:SEQ:10.23.0.32711:xxx.yyy:xxx.yyy.zzz:src/main/webapp/WEB-INF/templates/plugins/datepicker/locales/bootstrap-datepicker.no.js' containing 1 file(s)
[2025-06-20T13:33:41.537Z] [DEBUG] Cache entry created for key 'jssecurity:ucfgs:JSON:10.23.0.32711:xxx.yyy:xxx.yyy.zzz:src/main/webapp/WEB-INF/templates/plugins/datepicker/locales/bootstrap-datepicker.no.js'
[2025-06-20T13:33:41.794Z] [DEBUG] Cache entry created for key 'js:filemetadata:10.23.0.32711:xxx.yyy:xxx.yyy.zzz:src/main/webapp/WEB-INF/templates/plugins/datepicker/locales/bootstrap-datepicker.no.js'
[2025-06-20T13:33:41.794Z] [DEBUG] Cache strategy set to 'WRITE_ONLY' for file 'src/main/webapp/WEB-INF/templates/plugins/handsontable/moment/locale/kk.js' as current analysis requires all files to be analyzed
[2025-06-20T13:33:41.794Z] [DEBUG] Analyzing file: file:///home/jenkins/agent/workspace/Snapshot_Pipeline_fix_sonarissue/src/main/webapp/WEB-INF/templates/plugins/handsontable/moment/locale/kk.js
[2025-06-20T13:33:41.794Z] [INFO] Written udg to file: /home/jenkins/agent/workspace/Snapshot_Pipeline_fix_sonarissue/target/sonar/architecture/js/___src_main_webapp_WEB-INF_templates_plugins_datepicker_locales_bootstrap-datepicker_no_js.udg
[2025-06-20T13:33:43.159Z] [INFO] 160/188 files analyzed, current file: src/main/webapp/WEB-INF/templates/plugins/handsontable/moment/locale/kk.js
[2025-06-20T13:33:43.159Z] [DEBUG] Analyzing file "/home/jenkins/agent/workspace/Snapshot_Pipeline_fix_sonarissue/src/main/webapp/WEB-INF/templates/plugins/handsontable/moment/locale/kk.js"
[2025-06-20T13:33:44.088Z] [DEBUG] Parsing /home/jenkins/agent/workspace/Snapshot_Pipeline_fix_sonarissue/src/main/webapp/WEB-INF/templates/plugins/handsontable/moment/locale/kk.js with typescript-eslint/parser
[2025-06-20T13:33:54.038Z] [INFO] 160/188 files analyzed, current file: src/main/webapp/WEB-INF/templates/plugins/handsontable/moment/locale/kk.js
[2025-06-20T13:33:54.965Z] decp/zzz-snapshot-pipeline-fix-2fsonarissue-55-hx7g1 Container mavensonar was terminated (Exit Code: 137, Reason: OOMKilled)
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z] - checkmarxcli -- running
[2025-06-20T13:33:55.070Z] -----Logs-------------
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z] - jnlp -- running
[2025-06-20T13:33:55.070Z] -----Logs-------------
[2025-06-20T13:33:55.070Z] at hudson.remoting.UserRequest.perform(UserRequest.java:211)
[2025-06-20T13:33:55.070Z] at hudson.remoting.UserRequest.perform(UserRequest.java:54)
[2025-06-20T13:33:55.070Z] at hudson.remoting.Request$2.run(Request.java:377)
[2025-06-20T13:33:55.070Z] at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
[2025-06-20T13:33:55.070Z] at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[2025-06-20T13:33:55.070Z] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[2025-06-20T13:33:55.070Z] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[2025-06-20T13:33:55.070Z] at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125)
[2025-06-20T13:33:55.070Z] at java.base/java.lang.Thread.run(Unknown Source)
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z] Jun 20, 2025 1:26:01 PM org.jenkinsci.plugins.workflow.log.TaskListenerDecorator$DecoratedTaskListener getLogger
[2025-06-20T13:33:55.070Z] WARNING: null
[2025-06-20T13:33:55.070Z] java.lang.IllegalStateException: Expected 1 instance of hudson.plugins.gradle.injection.InjectionConfig but got 0
[2025-06-20T13:33:55.070Z] at hudson.ExtensionList.lookupSingleton(ExtensionList.java:454)
[2025-06-20T13:33:55.070Z] at hudson.plugins.gradle.injection.InjectionConfig.get(InjectionConfig.java:81)
[2025-06-20T13:33:55.070Z] at hudson.plugins.gradle.injection.GradleEnterpriseExceptionTaskListenerDecoratorFactory$GradleEnterpriseExceptionTaskListenerDecorator.decorate(GradleEnterpriseExceptionTaskListenerDecoratorFactory.java:43)
[2025-06-20T13:33:55.070Z] at org.jenkinsci.plugins.workflow.log.TaskListenerDecorator$DecoratedTaskListener.getLogger(TaskListenerDecorator.java:253)
[2025-06-20T13:33:55.070Z] at org.jenkinsci.plugins.workflow.log.TaskListenerDecorator$CloseableTaskListener.getLogger(TaskListenerDecorator.java:296)
[2025-06-20T13:33:55.070Z] at hudson.tasks.junit.JUnitParser$ParseResultCallable.invoke(JUnitParser.java:180)
[2025-06-20T13:33:55.070Z] at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3578)
[2025-06-20T13:33:55.070Z] at hudson.remoting.UserRequest.perform(UserRequest.java:211)
[2025-06-20T13:33:55.070Z] at hudson.remoting.UserRequest.perform(UserRequest.java:54)
[2025-06-20T13:33:55.070Z] at hudson.remoting.Request$2.run(Request.java:377)
[2025-06-20T13:33:55.070Z] at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
[2025-06-20T13:33:55.070Z] at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[2025-06-20T13:33:55.070Z] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[2025-06-20T13:33:55.070Z] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[2025-06-20T13:33:55.070Z] at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125)
[2025-06-20T13:33:55.070Z] at java.base/java.lang.Thread.run(Unknown Source)
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z] - maven -- running
[2025-06-20T13:33:55.070Z] -----Logs-------------
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z] - mavensonar -- terminated (137)
[2025-06-20T13:33:55.070Z] -----Logs-------------
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.070Z] - ucdclient -- running
[2025-06-20T13:33:55.070Z] -----Logs-------------
[2025-06-20T13:33:55.070Z]
[2025-06-20T13:33:55.438Z] Cannot contact zzz-snapshot-pipeline-fix-2fsonarissue-55-hx7g1: hudson.remoting.ChannelClosedException: Channel "hudson.remoting.Channel@6ab75de:JNLP4-connect connection from 192.168.137.67/192.168.137.67:58576": Remote call on JNLP4-connect connection from 192.168.137.67/192.168.137.67:58576 failed. The channel is closing down or has closed down
[2025-06-20T13:38:55.102Z] Agent zzz-snapshot-pipeline-fix-2fsonarissue-55-hx7g1 was deleted; cancelling node body
[2025-06-20T13:38:55.103Z] Could not connect to zzz-snapshot-pipeline-fix-2fsonarissue-55-hx7g1 to send interrupt signal to process
[2025-06-20T13:38:55.124Z] [Pipeline] }
[2025-06-20T13:38:55.194Z] [Pipeline] // container
[2025-06-20T13:38:55.232Z] [Pipeline] }
[2025-06-20T13:38:55.313Z] [Pipeline] // withSonarQubeEnv
[2025-06-20T13:38:55.384Z] [Pipeline] }
It looks like you might have some third-party code that needs to be excluded from analysis. Third-party libraries should not be analyzed by SonarQube (at least, the code itself should not be analyzed, and can cause the scanner to behave in unexpected ways.
Set sonar.exclusions to exclude these files or folders from analysis. For example, you can add the following to your sonar-project.properties file:
Thank you. I’ve excluded the plugins and also added -Dsonar.javascript.node.maxspace property. The problem hasn’t happened again since I made this addition.