OutOfMemoryError: PermGen space, Java Oracle7, gradle>2.1, Codenarc >0.21 #116

Closed
tkruse opened this Issue Aug 9, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@tkruse

This comment has been minimized.

Show comment
Hide comment
@tkruse

tkruse Aug 9, 2015

I could reproduce for 0.21, 0.22, 0.23 and 0.24, though 0.22 and 0.23 seem to work fine with gradle 2.3 (but not 2.4 or 2.5).

Travis uses oracle java version "1.7.0_76", whereas locally I use "1.7.0_80".

Note the error happens always on the same groovy file, the contents of which are:

package com.example
import org.junit.Test
/**
 * example test
 */
class ExampleTest {
    @Test
    void testHelloWorld() {
        Example example = new Example()
        assert example.helloWorld() == 'Hello World'
    }
}

This being the only test groovy file in the project where the build fails.
I have seen codenarc taking 5 seconds to analyze this file in successful runs on CI.

This only seems to occur when running a full gradle check, just running gradle codenarcTest does not reproduce the problem.

I could not reproduce with --debug on travis (logfile too long), but here is the final output of --info:

:simpleGroovy:codenarcTest
Executing task ':simpleGroovy:codenarcTest' (up-to-date check took 0.014 secs) due to:
  No history is available.
Loaded properties file in 13ms; 341 rules
Loading ruleset from [file:/home/travis/build/tkruse/gradle-groovysh-plugin/samples/config/codenarc/rules.groovy]
Loading ruleset from [rulesets/basic.xml]
Loading ruleset from [rulesets/braces.xml]
Loading ruleset from [rulesets/concurrency.xml]
Loading ruleset from [rulesets/convention.xml]
Loading ruleset from [rulesets/design.xml]
Loading ruleset from [rulesets/dry.xml]
Loading ruleset from [rulesets/exceptions.xml]
Loading ruleset from [rulesets/formatting.xml]
Loading ruleset from [rulesets/groovyism.xml]
Loading ruleset from [rulesets/imports.xml]
Loading ruleset from [rulesets/junit.xml]
Loading ruleset from [rulesets/logging.xml]
Loading ruleset from [rulesets/naming.xml]
Loading ruleset from [rulesets/security.xml]
Loading ruleset from [rulesets/serialization.xml]
Loading ruleset from [rulesets/size.xml]
Loading ruleset from [rulesets/unnecessary.xml]
Loading ruleset from [rulesets/unused.xml]
RuleSet configuration properties file [codenarc.properties] not found.
Analysis time=12849ms
No custom message bundle found for [codenarc-messages]. Using default messages.
:simpleGroovy:codenarcTest FAILED
:simpleGroovy:codenarcTest (Thread[main,5,main]) completed. Took 36.155 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':simpleGroovy:codenarcTest'.
> java.lang.OutOfMemoryError: PermGen space

It seems I can reliably reproduce on Travis, though my builds take 6 minutes to finish.

However I am not sure that codenarc is the culprit, maybe it is a coincidence that for these builds, it just uses up the last bit of memory. Close this issue if you think that is the case.

tkruse commented Aug 9, 2015

I could reproduce for 0.21, 0.22, 0.23 and 0.24, though 0.22 and 0.23 seem to work fine with gradle 2.3 (but not 2.4 or 2.5).

Travis uses oracle java version "1.7.0_76", whereas locally I use "1.7.0_80".

Note the error happens always on the same groovy file, the contents of which are:

package com.example
import org.junit.Test
/**
 * example test
 */
class ExampleTest {
    @Test
    void testHelloWorld() {
        Example example = new Example()
        assert example.helloWorld() == 'Hello World'
    }
}

This being the only test groovy file in the project where the build fails.
I have seen codenarc taking 5 seconds to analyze this file in successful runs on CI.

This only seems to occur when running a full gradle check, just running gradle codenarcTest does not reproduce the problem.

I could not reproduce with --debug on travis (logfile too long), but here is the final output of --info:

:simpleGroovy:codenarcTest
Executing task ':simpleGroovy:codenarcTest' (up-to-date check took 0.014 secs) due to:
  No history is available.
Loaded properties file in 13ms; 341 rules
Loading ruleset from [file:/home/travis/build/tkruse/gradle-groovysh-plugin/samples/config/codenarc/rules.groovy]
Loading ruleset from [rulesets/basic.xml]
Loading ruleset from [rulesets/braces.xml]
Loading ruleset from [rulesets/concurrency.xml]
Loading ruleset from [rulesets/convention.xml]
Loading ruleset from [rulesets/design.xml]
Loading ruleset from [rulesets/dry.xml]
Loading ruleset from [rulesets/exceptions.xml]
Loading ruleset from [rulesets/formatting.xml]
Loading ruleset from [rulesets/groovyism.xml]
Loading ruleset from [rulesets/imports.xml]
Loading ruleset from [rulesets/junit.xml]
Loading ruleset from [rulesets/logging.xml]
Loading ruleset from [rulesets/naming.xml]
Loading ruleset from [rulesets/security.xml]
Loading ruleset from [rulesets/serialization.xml]
Loading ruleset from [rulesets/size.xml]
Loading ruleset from [rulesets/unnecessary.xml]
Loading ruleset from [rulesets/unused.xml]
RuleSet configuration properties file [codenarc.properties] not found.
Analysis time=12849ms
No custom message bundle found for [codenarc-messages]. Using default messages.
:simpleGroovy:codenarcTest FAILED
:simpleGroovy:codenarcTest (Thread[main,5,main]) completed. Took 36.155 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':simpleGroovy:codenarcTest'.
> java.lang.OutOfMemoryError: PermGen space

It seems I can reliably reproduce on Travis, though my builds take 6 minutes to finish.

However I am not sure that codenarc is the culprit, maybe it is a coincidence that for these builds, it just uses up the last bit of memory. Close this issue if you think that is the case.

@chrismair

This comment has been minimized.

Show comment
Hide comment
@chrismair

chrismair Aug 16, 2015

Contributor

I noticed that the last few builds have been successful for the CI link given above. Was anything changed that is worth mentioning?

Contributor

chrismair commented Aug 16, 2015

I noticed that the last few builds have been successful for the CI link given above. Was anything changed that is worth mentioning?

@tkruse

This comment has been minimized.

Show comment
Hide comment
@tkruse

tkruse Aug 17, 2015

I merely split up the gradle tasks into 2 invocations, I found no real solution or culprit. Removing any of check style, pmd or codenarc led to the problem not occurring anymore. So I tend to think its rather a gradle problem when having many tiny submodules.

tkruse commented Aug 17, 2015

I merely split up the gradle tasks into 2 invocations, I found no real solution or culprit. Removing any of check style, pmd or codenarc led to the problem not occurring anymore. So I tend to think its rather a gradle problem when having many tiny submodules.

@melix

This comment has been minimized.

Show comment
Hide comment
@melix

melix Aug 31, 2015

For reference, I think I have found the reason for the leak. I am working on a fix, it is explained here: http://melix.github.io/blog/2015/08/permgenleak.html

melix commented Aug 31, 2015

For reference, I think I have found the reason for the leak. I am working on a fix, it is explained here: http://melix.github.io/blog/2015/08/permgenleak.html

@chrismair

This comment has been minimized.

Show comment
Hide comment
@chrismair

chrismair Feb 14, 2016

Contributor

See Cédric Champeau's blog link above -- a very interesting and in-depth exploration of the PermGen issue. The issue is not specifically within CodeNarc or the CodeNarc plugin.

Contributor

chrismair commented Feb 14, 2016

See Cédric Champeau's blog link above -- a very interesting and in-depth exploration of the PermGen issue. The issue is not specifically within CodeNarc or the CodeNarc plugin.

@chrismair chrismair closed this Feb 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment