Search code examples
javamavengarbage-collectionout-of-memoryfindbugs

java.lang.OutOfMemoryError: GC overhead limit exceeded while running findbugs in maven


So basically the current configuration works for all the builds. But this time. Added some code to the project, but this time the build fails and throws

java.lang.OutOfMemoryError: GC overhead limit exceeded

while FindBugs analysis. while searching out more on this I found out there is a <effort> option in the FindBugs configuration in the POM file. So I tried to set it to <effort>min</effort> it was <effort>max</effort> before. But this also does not seems to be working. Also there is a restriction in changing VM parameters so I am not allowed to do it.

Stack trace:

Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded
     [java]     at java.util.BitSet.initWords(BitSet.java:166)
     [java]     at java.util.BitSet.<init>(BitSet.java:143)
     [java]     at edu.umd.cs.findbugs.ba.LiveLocalStoreAnalysis.createFact(LiveLocalStoreAnalysis.java:58)
     [java]     at edu.umd.cs.findbugs.ba.LiveLocalStoreAnalysis.createFact(LiveLocalStoreAnalysis.java:45)
     [java]     at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:318)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.LiveLocalStoreDataflowFactory.analyze(LiveLocalStoreDataflowFactory.java:68)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.LiveLocalStoreDataflowFactory.analyze(LiveLocalStoreDataflowFactory.java:38)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:369)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:

I am not able to find whether something is wrong with my new code which I added or it is the problem with the FindBugs. My code is just a regular stuff (I believe that). Even if something is wrong with my code FindBugs is supposed to report it instead of crashing the JVM itself.

We use FindBugs 3.0.5 with default JVM options


Solution

  • Actually, After lots of efforts and research, the found an option in the maven findbugs help documentation within maven a way to specify heap size of the forked jvm as indicated by @second in the first comment of the question. SO inside the POM XML within the inside the findbug's tag I can specify 1024 like the following:

    <plugin>
        <groupId>com.github.findbugs</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>3.1.12</version>
        <configuration>
           ...
          <maxHeap>1024</maxHeap>
           ...
        </configuration>
           ...       
      </plugin>
    

    I almost forgot to post back. Leaving it here in the hope to help someone like me when I was. Thanks to @second for pointing in the right direction.