Sonar qube ERROR: Error during SonarScanner execution java.lang.OutOfMemoryError: Java heap space

during sonarqube scan getting this error please help

INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:36.922s
INFO: Final Memory: 18M/123M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.OutOfMemoryError: Java heap space
	at java.base/java.util.Arrays.copyOf(Arrays.java:3689)
	at java.base/java.util.ArrayList.grow(ArrayList.java:238)
	at java.base/java.util.ArrayList.grow(ArrayList.java:243)
	at java.base/java.util.ArrayList.add(ArrayList.java:486)
	at java.base/java.util.ArrayList.add(ArrayList.java:499)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:62)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
	at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)

ERROR:

Hey there.

These logs unfortunately don’t tell us much, like where in analysis the error occurs. Can you share the full logs (redacting information if necessary?)

NFO: 50 files indexed
INFO: 141 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for py: Sonar way
INFO: ------------- Run sensors on module -qa-migration-gui-code
INFO: JavaScript/TypeScript frontend is enabled
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=187ms
INFO: Sensor CSS Rules [cssfamily]
INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
INFO: Sensor CSS Rules [cssfamily] (done) | time=2ms
INFO: Sensor C# Project Type Information [csharp]
INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=0ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=2ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=4ms
INFO: Sensor Compute size of configuration file [mulevalidationsonarqubepluginmule]
INFO: Sensor Compute size of configuration file [mulevalidationsonarqubepluginmule] (done) | time=1ms
INFO: Sensor Compute number of unit test cases [mulevalidationsonarqubepluginmule]
INFO: Sensor Compute number of unit test cases [mulevalidationsonarqubepluginmule] (done) | time=0ms
INFO: Sensor VB.NET Project Type Information [vbnet]
INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms
INFO: Sensor VB.NET Properties [vbnet]
INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
INFO: Sensor Python Sensor [python]
INFO: Starting global symbols computation
INFO: 35 source files to be analyzed
INFO: Load project repositories
INFO: Load project repositories (done) | time=100ms
INFO: 0/35 files analyzed, current file: gui/dataset/datasetmanager.py
INFO: 0/35 files analyzed, current file:gui/dataset/datasetmanager.py
INFO: 0/35 files analyzed, current file: gui/dataset/datasetmanager.py
INFO: 0/35 files analyzed, current file: lgui/dataset/datasetmanager.py
INFO: 0/35 files analyzed, current file: algui/dataset/datasetmanager.py
INFO: 0/35 files analyzed, current file: algui/dataset/datasetmanager.py
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2:07.201s
INFO: Final Memory: 19M/123M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.lang.OutOfMemoryError: Java heap space
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitTerminal(LexerfulAstCreator.java:85)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:49)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visitNonTerminal(LexerfulAstCreator.java:56)
at org.sonar.sslr.internal.matchers.LexerfulAstCreator.visit(LexerfulAstCreator.java:47)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
[Pipeline] }
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv

i have tried like

stage(‘SonarQube’) {
steps {
withSonarQubeEnv(‘Sonarqube_QA’) { //SONAR_HOST_URL and SONAR_AUTH_TOKEN injected via plugin
sh ‘’’
export SONAR_SCANNER_OPTS=“-Xmx512m”
${SONAR_HOME}/bin/sonar-scanner
-Dsonar.projectKey=${SONAR_PROJECT_KEY}
-Dsonar.projectVersion=${SONAR_PROJECT_VERSION}
-Dsonar.sources=${PROJECT_CODE_SOURCES}
-Dsonar.sourceEncoding=UTF8
-Dsonar.host.url=${SONAR_HOST_URL}
-Dsonar.login=${SONAR_AUTH_TOKEN}
-Dsonar.verbose=true
‘’’
}
timeout(time: 10, unit: ‘MINUTES’) {
waitForQualityGate abortPipeline: true
}
}
}
but its killing the process


/home/jenkins/agent/workspace/********@tmp/durable-1e2999fc/script.sh: line 3: 207 Killed ${SONAR_HOME}/bin/sonar-scanner -Dsonar.projectKey=${SONAR_PROJECT_KEY} -Dsonar.projectVersion=${SONAR_PROJECT_VERSION} -Dsonar.sources=${PROJECT_CODE_SOURCES} -Dsonar.sourceEncoding=UTF8 -Dsonar.host.url=${SONAR_HOST_URL} -Dsonar.login=${SONAR_AUTH_TOKEN}

any update

Please read our FAQ and do not bump threads.

What version of SonarQube are you using? As noted in the template post:

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)