kares / jruby-rack-worker

Thread-ed Background Workers on top of JRuby::Rack
Apache License 2.0
53 stars 15 forks source link

Memory Leak Warning on Tomcat Restart #20

Closed ylansegal closed 8 years ago

ylansegal commented 8 years ago

While doing a tomcat restart on one of our production servers today, we noticed a warning:

SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal](value [java.lang.ThreadLocal@7d9e9078]) and a value of type [org.jruby.EvalType](value [NONE]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

Our project is running a Rails application on JRuby 9.1.5.0. This is the first tomcat restart after the application migrated from 1.7.23 and also upgraded jruby-rack-worker.

My research suggest that this issue is stems from Tomcat trying to verify that there are no ThreadLocal references that are left dangling as described in Stackoverflow and that commit c0fedc424e7b7aad5bcec64cc7f437c6664a2ce7 might have inadvertently introduced this issue.

Your work on this library is much appreciated.

kares commented 8 years ago

this is coming from JRuby - one can come up with some sophisticated cleanup on re-deploys but generally it should not leak. if it does it's more likely a JRuby issue itself.

ylansegal commented 8 years ago

Thanks for looking into it. I'll open an issue with JRuby.

kares commented 8 years ago

after https://github.com/jruby/jruby/pull/4215 ... the obvious "NONE" ones should go away