resthub / springmvc-router

Adds route mapping capacity to any "Spring MVC based" webapp. Uses playframework.org Router implementation.
http://resthub.github.com/springmvc-router/
Other
167 stars 63 forks source link

Leaking ThreadLocal #53

Closed msiedlarek closed 10 years ago

msiedlarek commented 11 years ago

I've just noticed this message when Tomcat 7 undeployed my application:

Nov 02, 2013 7:54:22 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/someapp] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@77bb96da]) and a value of type [org.resthub.web.springmvc.router.HTTPRequestAdapter] (value [org.resthub.web.springmvc.router.HTTPRequestAdapter@32e552c3]) 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.
bclozel commented 11 years ago

I'll try to update that code and use Spring's request context holder instead of managing threadlocals myself.