How to solve Sonarqube java.lang.OutOfMemoryError: Java heap space - sonarqube

I'm using Sonarqube community version. I'm getting the following error,
Exception in thread "LOG_FLUSHER" Exception in thread "CHECKPOINT_WRITER" java.lang.OutOfMemoryError: Java heap space
at java.util.ArrayList.iterator(ArrayList.java:840)
at java.util.Collections$SynchronizedCollection.iterator(Collections.java:2031)
at com.persistit.Persistit.pollAlertMonitors(Persistit.java:2285)
at com.persistit.Persistit$LogFlusher.run(Persistit.java:192)
java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap$Values.iterator(HashMap.java:968)
at com.persistit.Persistit.earliestDirtyTimestamp(Persistit.java:1439)
at com.persistit.CheckpointManager.pollFlushCheckpoint(CheckpointManager.java:271)
at com.persistit.CheckpointManager.runTask(CheckpointManager.java:301)
at com.persistit.IOTaskRunnable.run(IOTaskRunnable.java:144)
at java.lang.Thread.run(Thread.java:748)
WARNING: WARN: [JOURNAL_FLUSHER] WARNING Journal flush operation took 7,078ms last 8 cycles average is 884ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1:17.852s
ERROR: Error during SonarQube Scanner execution
ERROR: Java heap space
ERROR:
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "CLEANUP_MANAGER"
INFO: Final Memory: 40M/989M
INFO: ------------------------------------------------------------------------
The SonarQube Scanner did not complete successfully
I have Changed the size in sonar.properties, still I'm facing the same problem. How to solve this.
sonar.web.javaOpts=-Xmx4G -Xms2048m -XX:+HeapDumpOnOutOfMemoryError
sonar.ce.javaOpts =-Xmx4G -Xms2048m -XX:+HeapDumpOnOutOfMemoryError
sonar.search.javaOpts=-Xmx4G -Xms2048m -XX:+HeapDumpOnOutOfMemoryError

What you've changed are the settings that allocate memory to SonarQube itself.
What you need to change is the setting that allocates memory to the analysis process. You haven't said which analyzer you're using, so the details will vary a little, but
for SonarQube Scanner export SONAR_SCANNER_OPTS="-Xmx512m"
for SonarQube Scanner for Maven export MAVEN_OPTS="-Xmx512m"

Large files in Project cause this problem, for me a 50MB XML file gives this error and this file was not important to the analysis process. I excluded this file in the configuration file (SonarQube.Analysis.xml) and the problem was solved

Related

Ho to increase Java heap space for jmeter

While running my test after some time i got below error like "java.lang.OutOfMemoryError: Java heap space"
Could some one please help me how to increase java heap space for jmeter.
2018-08-16 18:57:07,765 ERROR o.a.j.JMeter: Uncaught exception:
java.lang.OutOfMemoryError: Java heap space
2018-08-16 18:57:14,745 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-6
2018-08-16 18:57:14,745 ERROR o.a.j.JMeter: Uncaught exception:
java.lang.OutOfMemoryError: Java heap space
For JMeter 4.0 default settings are:
-Xms1g -Xmx1g -X:MaxMetaspaceSize=256m
For Windows you can amend them in 2x times:
set HEAP="-Xms2g -Xmx2g -X:MaxMetaspaceSize=512m" && jmeter.bat
For Linux/Unix/Macosx:
export HEAP="-Xms2g -Xmx2g -X:MaxMetaspaceSize=512m" && ./jmeter.sh
Also make sure you're following JMeter Best Practices and recommendations from the 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure

GC overhead limit exceeded running background task in version 5.5

I am running SonarQube 5.5 with the following wrapper config settings.
wrapper.java.initmemory=3
wrapper.java.maxmemory=4096
I am still getting the following stack trace, this project has run successfully with sonarqube 5.3.
2016.05.09 11:14:09 INFO [o.s.s.c.s.ComputationStepExecutor] Compute coverage measures | time=105ms
2016.05.09 11:14:09 INFO [o.s.s.c.s.ComputationStepExecutor] Compute comment measures | time=120ms
2016.05.09 11:14:14 INFO [o.s.s.c.s.ComputationStepExecutor] Copy custom measures | time=5667ms
2016.05.09 11:14:15 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=424ms
2016.05.09 11:14:26 ERROR [o.s.s.c.c.ComputeEngineContainerImpl] Cleanup of container failed
java.lang.OutOfMemoryError: GC overhead limit exceeded
2016.05.09 11:14:26 ERROR [o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AVSWNiXkOySW07vtMalp
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.Arrays.copyOfRange(Arrays.java:3664) ~[na:1.8.0_45]
at java.lang.StringBuffer.toString(StringBuffer.java:671) ~[na:1.8.0_45]
at java.io.StringWriter.toString(StringWriter.java:210) ~[na:1.8.0_45]
at org.apache.commons.lang.Entities.escape(Entities.java:838) ~[commons-lang-2.6.jar:2.6]
at org.apache.commons.lang.StringEscapeUtils.escapeXml(StringEscapeUtils.java:620) ~[commons-lang-2.6.jar:2.6]
at org.sonar.server.computation.step.DuplicationDataMeasuresStep$DuplicationVisitor.appendDuplication(DuplicationDataMeasuresStep.java:129) ~[sonar-server-5.5.jar:na]
Memory adjustments must be made in sonar.properties:
sonar.web.javaOpts (for Web Server JVM)
sonar.ce.javaOpts (for Compute Engine JVM)
sonar.search.javaOpts (for JVM running ElasticSearch).
In your case the memory exception occurs in a background task so it relates to Compute Engine (see SonarQube architecture for more insight).
Settings in wrapper.conf are not relevant here and should be left untouched (hence the # DO NOT EDIT THE FOLLOWING SECTIONS warning in the file).

Embedded Tomcat Would Not Start

I got this error when I run Jhipster project on Jrebel. I try to increase my java heap size until to 512m by insert this line to VM Argument on Arguments Tab, but can not solve the error. I want to ask what the cause of error and how to solve it?
${jrebel_args}
-Xms512m -Xmx1024m
[ERROR] org.springframework.boot.context.embedded.tomcat.ServletContextInitializerLifecycleListener - Error starting Tomcat context: org.springframework.beans.factory.BeanCreationException
Exception in thread "main"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"
Exception in thread "process reaper" Exception in thread "process reaper"
I solve this problem by add -XX:MaxPermSize=512m at VM Arguments (eclipse)
thanks to ZT (zeroturnaround) Support
Running JVM with JRebel will use up to 50% more memory, if it uses more then there is a problem. Just in case please try to double the max limit with -Xmx2048m . This must avoid the OutOfMemoryError . After that you can reduce it when observing the actual memory usage.

Read timed out on /batch/project (SonarQube 4.5)

I am struggling with the following problem.
Log of the executed when sonar-runner in Jenkins.
SonarQube Runner 2.4
Java 1.7.0_67 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
SONAR_RUNNER_OPTS=-Xms256m -Xmx512m
INFO: Runner configuration file: D:\CI_BUILD\sonar-runner-2.4\conf\sonar-runner.properties
INFO: Project configuration file: NONE
INFO: Default locale: "ko_KR", source code encoding: "UTF-8"
INFO: Work directory: D:\CI_BUILD\jenkins_home\jobs\CAFE-CLIENT\workspace\.sonar
INFO: SonarQube Server 4.5
05:17:52.119 INFO - Load global referentials...
05:17:53.382 INFO - Load global referentials done: 1263 ms
05:17:53.414 INFO - User cache: C:\Users\pcms_build\.sonar\cache
05:17:53.445 INFO - Install plugins
05:17:54.225 INFO - Install JDBC driver
05:17:54.303 INFO - Create JDBC datasource for jdbc:jtds:sqlserver://10.240.232.145/sonardb;SelectMethod=Cursor
05:17:56.222 INFO - Initializing Hibernate
05:17:59.217 INFO - Load project referentials...
05:18:19.232 INFO - Load project referentials done: 20015 ms
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 34.757s
Final Memory: 21M/291M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Unable to request: /batch/project?key=CAFE-CLIENT&preview=false
ERROR: Caused by: Read timed out
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
05:18:19.232 INFO - Load project referentials done: 20015 ms
When "Load project referentials done" value is larger than 20,000 ms,
Always "Read timed out" occurs.
Loading of project referentials is not expected to take more than a few seconds. It is very likely you have a performance issue on your SQ server (or with your DB). Here are some criteria that may increase duration of this web service:
you have installed a lot of language plugins or you have enabled a lot of rules in quality profiles
your project is a multi-module project with a lot of modules
Compare for example with:
http://nemo.sonarqube.org/batch/project?key=org.codehaus.sonar%3Asonar&preview=true
that returns more than 1000 rules and 33 modules. It takes less than 2 seconds to return data.
EDIT: it seems there was some SQL issues depending on your DB vendor. See http://jira.codehaus.org/browse/SONAR-5849 and http://jira.codehaus.org/browse/SONAR-6063. Should be fixed in upcoming 4.5.3

Unable to deploy application on Websphere 8.0 due to OutOfMemory error

When I start to deploy my application, the build is successful but I get the following error while installing:
[exec] JVMDUMP039I Processing dump event "systhrow", detail "java/lang/OutOfMemoryError" at 2013/07/09 13:55:51 - please wait.
[exec] JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".
[exec] WASX7017E: Exception received while running file "deployStartApp_DEV1.py"; exception information: com.ibm.websphere.management.application.client.AppDeploymentException: com.ibm.websphere.management.application.client.AppDeploymentException: [Root exception is java.lang.OutOfMemoryError: Java heap space]
[exec] java.lang.OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space
I tried increasing the heap size, but it didn't help. Can anybody help me out? I could not find a solution for deploying on WebSphere 8.0
Since I understand you are using wsadmin to do your deployment you might want to use something like:
wsadmin.bat -javaoption –Xms256m -javaoption –Xmx768m
when calling the wsadmin command.
More on this here and here.

Resources