OutOfMemoryError: GC overhead limit exceeded with -Xmx1536m setting in place

Hey,

Perhaps the issue is related to this topic:
https://groups.google.com/d/topic/sonarqube/iRipZpZUs-c/discussion
https://jira.sonarsource.com/browse/SONARJAVA-2611
For us this started happening once we upgraded to java plugin v 5.4 (build 14284)
It is a pity but I cannot find a workaround and will have to exclude the class that causes it :frowning:

Using Community EditionVersion 7.2 (build 13530).

I am getting the exception below. I tried to increase memory settings, but that did not help.

Current Java options passed from Jenkins instance to Ant build scripts is set to:
-Xmx1536m -Xms1024M -XX:MaxDirectMemorySize=2G

15:27:21 c:\users\nirdevadm\jenkins\workspace\10.3.S_sonar_java\build\change-management\sonar.xml:417: java.lang.OutOfMemoryError: GC overhead limit exceeded
15:27:21 	at java.util.stream.DistinctOps.makeRef(DistinctOps.java:55)
15:27:21 	at java.util.stream.ReferencePipeline.distinct(ReferencePipeline.java:384)
15:27:21 	at org.sonar.java.se.FlowComputation$ExecutionPath.flowFromLearnedConstraints(FlowComputation.java:413)
15:27:21 	at org.sonar.java.se.FlowComputation$ExecutionPath.addEdge(FlowComputation.java:314)
15:27:21 	at org.sonar.java.se.FlowComputation$$Lambda$392/2146547913.apply(Unknown Source)
15:27:21 	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267)
15:27:21 	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
15:27:21 	at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1612)
15:27:21 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
15:27:21 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
15:27:21 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
15:27:21 	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
15:27:21 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
15:27:21 	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
15:27:21 	at org.sonar.java.se.FlowComputation.run(FlowComputation.java:173)
15:27:21 	at org.sonar.java.se.FlowComputation.flow(FlowComputation.java:151)
15:27:21 	at org.sonar.java.se.FlowComputation.flow(FlowComputation.java:118)
15:27:21 	at org.sonar.java.se.AlwaysTrueOrFalseExpressionCollector.flowFromNode(AlwaysTrueOrFalseExpressionCollector.java:84)
15:27:21 	at org.sonar.java.se.AlwaysTrueOrFalseExpressionCollector$$Lambda$436/291294701.apply(Unknown Source)
15:27:21 	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
15:27:21 	at java.util.Iterator.forEachRemaining(Iterator.java:116)
15:27:21 	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
15:27:21 	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
15:27:21 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
15:27:21 	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
15:27:21 	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
15:27:21 	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
15:27:21 	at org.sonar.java.se.AlwaysTrueOrFalseExpressionCollector.collectFlow(AlwaysTrueOrFalseExpressionCollector.java:79)
15:27:21 	at org.sonar.java.se.AlwaysTrueOrFalseExpressionCollector.flowForExpression(AlwaysTrueOrFalseExpressionCollector.java:66)
15:27:21 	at org.sonar.java.se.checks.BooleanGratuitousExpressionsCheck.reportBooleanExpression(BooleanGratuitousExpressionsCheck.java:47)
15:27:21 	at org.sonar.java.se.checks.BooleanGratuitousExpressionsCheck.checkEndOfExecution(BooleanGratuitousExpressionsCheck.java:41)
15:27:21 	at org.sonar.java.se.CheckerDispatcher.executeCheckEndOfExecution(CheckerDispatcher.java:135)

Any idea how to fix?

Would you be able to share the class causing trouble (privately if you wish)?

Sure. Attaching it here.
nRealmXMLImport.txt (79.5 KB)

By the way, after I excluded it, the build passed so I am pretty sure it is causing the problem.
I am not happy with the exclusion, so if you come up with some workaround - that would be lovely :slight_smile:

Many thanks.

Hey guys,

I managed to reach the GC overhead limit on smaller projects by accidentally including a third party huuge file in the analysis. When a .js file is around ~70k lines it tends to cause some problems for example. Correcting file inclusion/exclusion patterns fixes this.
This might not directly solve your issue @vazzilena , just wanted to add it for any future passerbys.

Cheers,
Balázs

1 Like

hello @vazzilena,

we are coming back to some old threads, where the conclusion is missing. I tried to reproduce the issue with the code you provided and I didn’t see any issue with the latest version. Feel free to reach back to us if you are still having a problem.