jakartaee / expression-language

Jakarta Expression Language
https://eclipse.org/ee4j/el
Other
68 stars 49 forks source link

com.sun.el.lang.ExpressionBuilder #23

Closed glassfishrobot closed 13 years ago

glassfishrobot commented 13 years ago

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/

glassfishrobot commented 6 years ago
glassfishrobot commented 13 years ago

@glassfishrobot Commented Reported by smalesev

glassfishrobot commented 13 years ago

@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 13 years ago

@glassfishrobot Commented kchung said: New and improved. Thanks to Stevan

glassfishrobot commented 13 years ago

@glassfishrobot Commented File: el-api-1.1.jar Attached By: kchung

glassfishrobot commented 13 years ago

@glassfishrobot Commented File: el-impl-1.1.jar Attached By: kchung

glassfishrobot commented 13 years ago

@glassfishrobot Commented Was assigned to kchung

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA UEL-23

glassfishrobot commented 13 years ago

@glassfishrobot Commented Marked as fixed on Monday, June 6th 2011, 10:56:26 am