Hello. Currently I'm working on the IGNITE-967 <https://issues.apache.org/jira/browse/IGNITE-967>.
In fact, it is well known, easily reproduceable, ClassLoader memory leak problem in managed environments, such as servlet containers. See http://wiki.apache.org/tomcat/MemoryLeakProtection to read more on that. In short, the code using thread locals is responsible for cleaning them after request processing to prevent memory leaks related to different lifetime of application and thread in pool. Also blindly reusing thread from pool can be dangerous, because current ThreadLocal value can be different from expected default value. One posiible way of solving the problem is using post-processing Filter, which is responsible for cleaning all thread locals on current thread. Another approach would be sticking with container's specific solution to this problem. On example, tomcat provides the configuration property renewThreadsWhenStoppingContext, which forces it to renew threads involved in servicing requests for destroyed context, thus removing leaks. What do you think? -- Best regards, Alexei Scherbakov