Harmless checkThreadLocalMapForLeaks messages on catalina.out
Bitbucket Server logs the following messages on
<Bitbucket Server 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.
When you shutdown Bitbucket Server, and it also stops Tomcat, Tomcat checks for ThreadLocal values and logs about any it finds.
These ThreadLocal instances are being created by libraries Bitbucket Server uses, not by Bitbucket Server code. That includes ThreadLocalinstances with
com.atlassian in the name; those are libraries maintained by other teams and used cross-product by Bitbucket Server, JIRA, Confluence, etc. There are other warnings caused by Apache Felix, Soy, and sometimes others. Since we (the Bitbucket Server 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 Bitbucket Server in the Tomcat we bundle with it, which means the entire JVM, including Tomcat, is shutdown when Bitbucket Server is stopped. Undeploying and redeploying Bitbucket Server is not a supported lifecycle.
These messages are harmless. There is nothing to worry about.
Since you're shutting down Tomcat itself, rather than undeploying Bitbucket Server 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 Bitbucket Server 3.6 these messages are not logged anymore.