Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5187

Groovy Script Engine creates new classes for each script and doesn't get garbage collected

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.4, 2.0-beta-1
    • Fix Version/s: 2.0.6, 1.8.9
    • Component/s: GroovyScriptEngine
    • Labels:
      None

      Description

      New classes are created for each script:

      https://github.com/groovy/groovy-core/blob/master/src/main/org/codehaus/groovy/jsr223/GroovyScriptEngineImpl.java#L109

      Which are added to the classMap, which grows and old classes don't get garbage collected:

      https://github.com/groovy/groovy-core/blob/master/src/main/org/codehaus/groovy/jsr223/GroovyScriptEngineImpl.java#L338

      This results in PermGen errors:

      Rexster Groovy Script Engine
      https://github.com/tinkerpop/rexster/issues/143

      Neo4j Server Groovy Script Engine
      http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Feedback-after-evaluation-tp3569774p3574520.html

      There is no public way of removing older scripts and the HashMap is not a LinkedHashMap with LRU enabled for storing them. Right now the Neo4j workaround is to recreated the GSE every 500 requests.

        Attachments

          Activity

            People

            • Assignee:
              blackdrag Jochen Theodorou
              Reporter:
              espeed James Thornton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: