Charles Oliver Nutter created JRUBY-6523: --------------------------------------------
Summary: Static ThreadLocals must be weak or soft or not static Key: JRUBY-6523 URL: https://jira.codehaus.org/browse/JRUBY-6523 Project: JRuby Issue Type: Bug Components: Core Classes/Modules Affects Versions: JRuby 1.6.7, JRuby 1.7 Reporter: Charles Oliver Nutter Fix For: JRuby 1.6.8, JRuby 1.7 While fixing JRUBY-6522, I found that there are a few additional places where we have static ThreadLocals that can cause ClassLoader leaks in environments where a pool of threads may encounter multiple JRuby runtimes, such as when applications are redeployed to a webapp server. I audited for static threadlocals, and found the following: org.jruby.ext.ffi.AutoPointer:25 {noformat} private static final ThreadLocal<ReaperGroup> currentReaper = new ThreadLocal<ReaperGroup>(); {noformat} org.jruby.ext.ffi.jffi.AllocatedNativeMemoryIO:14 {noformat} private static final ThreadLocal<AllocationGroup> currentBucket = new ThreadLocal<AllocationGroup>(); {noformat} org.jruby.ext.ffi.jffi.TransientNativeMemoryIO:43 {noformat} private static final ThreadLocal<Magazine> currentMagazine = new ThreadLocal<Magazine>(); {noformat} org.jruby.interpreter.IRBreakJump:13 {noformat} private static ThreadLocal<IRBreakJump> threadLocalBJ = new ThreadLocal<IRBreakJump>() { public IRBreakJump initialValue() { return new IRBreakJump(); } }; {noformat} org.jruby.interpreter.IRReturnJump:11 {noformat} private static ThreadLocal<IRReturnJump> threadLocalRJ = new ThreadLocal<IRReturnJump>() { public IRReturnJump initialValue() { return new IRReturnJump(); } }; {noformat} There's also this in org.jruby.Ruby, but I'm not sure if it's a risk; it's explicitly used for thread-local stuff, but via an API we don't publish or recommend. Perhaps it should be removed? {noformat} private static ThreadLocal<Ruby> threadLocalRuntime = new ThreadLocal<Ruby>(); {noformat} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email