Java.lang.outofmemoryerror gc overhead limit exceeded sonarqube


We are using Sonarqube - Community Edition Version 7.9.4 in Docker container
And we have Jenkins and SonarQube-Scanner- (both) inside another container

Everything is working as expected and it is scanning all the projects, but suddenly for one project it it throwing an error “java.lang.outofmemoryerror gc overhead limit exceeded sonarqube”.

I have already set the as - “sonar.web.javaOpts=-Xmx1024m -Xms512m -XX:+HeapDumpOnOutOfMemoryError”

In our case where do we have to set “SONAR_SCANNER_OPTS” as we have 2 container 1 for sonarqube and other for jenkins + scanner.

In we have defined - SONAR_SCANNER_OPTS="-Xmx512m"

Can you please suggest us the solution for that

But still getting the same issuesonar0


When you set sonar.web.javaOpts=-Xmx1024m -Xms512m -XX:+HeapDumpOnOutOfMemoryError in you updated the server configuration. To alter the memory available to analysis, you’ll need to set SONAR_SCANNER_OPTS on the Jenkins side.


Hi Ann,

As you suggested I have tried to provide SONAR_SCANNER_OPTS on Jenkins side, But after that when I executing the scan then it is throwing different error.
I have set SONAR_SCANNER_OPTS="-Xmx1024m" as environment in jenkins container.
But now it is throwing “Error: Could not find or load main class “-Xmx1024m””


I’m confused.

This doesn’t seem related to the error message you’re getting, but one thing I notice is that you have spaces in your command line between -D and the key/value pairs. E.G. instead of -D sonar.projectKey=Ecosmod.btifixloy-web.PR-33 it should be -Dsonar.projectKey=Ecosmod.btifixloy-web.PR-33.

This probably won’t make a difference, but how about fixing all those spaces & trying again, just to eliminate that variable.