Closed glassfishrobot closed 13 years ago
@glassfishrobot Commented Reported by smalesev
@glassfishrobot Commented kchung said: I fixed the leak by also making a SoftReference of the key, and add a ReferenceQueue to monitor the keys are removed by the garbage collector. There is now a check on the ReferenceQueue on the put method to see if there are any entries in the queue, and if so, empty the queue and remove the corresponding entries in the HashMap.
Hopefully the performance won't be too much affected by this change.
Attached are the two jars. The change is in el-impl.jar only. The jars will be placed in the maven repo later. These jar are here for the impatient.
@glassfishrobot Commented kchung said: New and improved. Thanks to Stevan
@glassfishrobot Commented File: el-api-1.1.jar Attached By: kchung
@glassfishrobot Commented File: el-impl-1.1.jar Attached By: kchung
@glassfishrobot Commented Was assigned to kchung
@glassfishrobot Commented This issue was imported from java.net JIRA UEL-23
@glassfishrobot Commented Marked as fixed on Monday, June 6th 2011, 10:56:26 am
We have application which is leaking memory from cache inside com.sun.el.lang.ExpressionBuilder. Basically cache implementation is leaking keys in the cache as values get released as soft refs but keys are leaking. After 6hrs into the test there 268182 entries in ExpressionBuilder.cache where soft refs are gone and cache pins total of 117MB of memory. Then after 22h into the test there are 485497 entries in ExpressionBuilder.cache where soft refs are gone and cache pins total of 221MB of memory. This is very big leak
The main issue is that cache implementation is unbounded with keys leaking. The code needs to make sure it prunes keys whose soft refs are gone, potentially by using ReferenceQueue
Environment
Version used
http://download.java.net/maven/2/javax/el/el-api/1.1.1-b02/ http://download.java.net/maven/2/org/glassfish/web/el-impl/1.1.1-b03/