Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.4, 2.0-beta-1
-
Component/s: GroovyScriptEngine
-
Labels:None
-
Number of attachments :
Description
New classes are created for each script:
Which are added to the classMap, which grows and old classes don't get garbage collected:
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.
I made the map a soft reference based one. It can now forget entries over time. OOME can still happen of course, since class unloading is not always done as it should by the JVM, but the cases are very much reduced. This solution is kind of a middle ground. A LRU could still cause OOME, on the other hand the engine is originally not created to forget classes.