Harmless checkThreadLocalMapForLeaks messages on catalina.out
Symptoms
Stash logs the following messages on <Stash installation directory>/logs/catalina.out:
11-Dec-2014 10:09:09.133 SEVERE [localhost-startStop-2]org.apache.catalina.loader.WebappClassLoader.checkThreadLocalMapForLeaks The web application [] created a ThreadLocal with key of type [com.atlassian.plugin.util.ClassLoaderStack$1] (value[com.atlassian.plugin.util.ClassLoaderStack$1@73490731]) and a value of type [java.util.LinkedList] (value [[]]) 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.
Cause
When you shutdown Stash, and it also stops Tomcat, Tomcat checks for ThreadLocal values and logs about any it finds.
These ThreadLocal instances are being created by libraries Stash uses, not by Stash code. That includes ThreadLocalinstances with com.atlassian
in the name; those are libraries maintained by other teams and used cross-product by Stash, JIRA, Confluence, etc. There are other warnings caused by Apache Felix, Soy, and sometimes others. Since we (the Stash team, not Atlassian) don't have direct control over any of the codebases where these are being created, it hasn't been high on our priority list to try and address them.
Additionally, we don't support any deployment model other than running Stash in the Tomcat we bundle with it, which means the entire JVM, including Tomcat, is shutdown when Stash is stopped. Undeploying and redeploying Stash is not a supported lifecycle.
Resolution
These messages are harmless. There is nothing to worry about.
Since you're shutting down Tomcat itself, rather than undeploying Stash and leaving Tomcat up (potentially with other webapps in it), this "severe" message actually is completely irrelevant: There's no potential for a memory leak because Tomcat itself has been shutdown too.
As of Stash 3.6 these messages are not logged anymore.