When running an application using Orika (v1.1.7) within container-managed
threads it seems that Orika causes a ClassLoader leak by attaching a
ThreadLocal
(ma.glasnost.orika.impl.mapping.strategy.MappingStrategyKey#strategyKey) to
container-managed threads, but never removing these.
In addition, MappingStrategyKey#toString() seems to happily throw NPEs when
Tomcat complains about the ThreadLocal-leak (I guess
getRawSourceType returns null):
-- 8< --
Jul 09, 2012 4:10:57 PM org.apache.catalina.loader.WebappClassLoader
clearThreadLocalMap
SEVERE: Unable to determine string representation of value of type
[ma.glasnost.orika.impl.mapping.strategy.MappingStrategyKey]
java.lang.NullPointerException
at ma.glasnost.orika.impl.mapping.strategy.MappingStrategyKey.toString(MappingStrategyKey.java:129)
at org.apache.catalina.loader.WebappClassLoader.clearThreadLocalMap(WebappClassLoader.java:2433)
at org.apache.catalina.loader.WebappClassLoader.clearReferencesThreadLocals(WebappClassLoader.java:2349)
at org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1921)
at org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1833)
at org.apache.catalina.loader.WebappLoader.stop(WebappLoader.java:740)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4920)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:936)
at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1359)
at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1330)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:326)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1110)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:468)
at org.apache.catalina.core.StandardService.stop(StandardService.java:604)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:788)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:662)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Jul 09, 2012 4:10:57 PM org.apache.catalina.loader.WebappClassLoader
clearThreadLocalMap
SEVERE: The web application [/logging] created a ThreadLocal with key of type
[ma.glasnost.orika.impl.mapping.strategy.MappingStrategyKey$1] (value
[ma.glasnost.orika.impl.mapping.strategy.MappingStrategyKey$1@2c62e3ea]) and a
value of type [ma.glasnost.orika.impl.mapping.strategy.MappingStrategyKey]
(value [Unknown]) but failed to remove it when the web application was stopped.
This is very likely to create a memory leak.
-- 8< --
Original issue reported on code.google.com by th...@ginkel.com on 10 Jul 2012 at 5:36
Original issue reported on code.google.com by
th...@ginkel.com
on 10 Jul 2012 at 5:36