Tomcat 6 ThreadLocal Memory Leak

Radek Kantor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2012

Hi,

how can I fix Tomcat 6 memory leaks in JIRA 4.4.3? Shoul be solved in Tomcat 7, but is is not supported by JIRA. More information about leak:

http://wiki.apache.org/tomcat/MemoryLeakProtection

I have a lot off error messages in JIRA log file like:

Feb 24, 2012 9:27:24 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [com.atlassian.jira.util.ImportUtils$3] (value [com.atlassian.jira.util.ImportUtils$3@d7580d]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Feb 24, 2012 9:27:24 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1d5ec12]) and a value of type [com.atlassian.jira.issue.index.SearcherCache] (value [com.atlassian.jira.issue.index.SearcherCache@17dcb1a]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Feb 24, 2012 9:27:24 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [com.atlassian.jira.dashboard.permission.JiraPermissionService$1] (value [com.atlassian.jira.dashboard.permission.JiraPermissionService$1@1108ae2]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Feb 24, 2012 9:27:24 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [com.sun.xml.bind.v2.runtime.Coordinator$1] (value [com.sun.xml.bind.v2.runtime.Coordinator$1@10e0d6a]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@192b3eb]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Feb 24, 2012 4:01:33 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [com.google.inject.InjectorImpl$10] (value [com.google.inject.InjectorImpl$10@47833f]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@f9c646]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

And after a week Tomcat (JIRA) crash on Java Heap Space. Can someone help? Thanks.

2 answers

1 accepted

0 votes
Answer accepted
Radek Kantor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2012

Looks that memory increase help, for now now JIRA crash - runs more than 2 weeks.

0 votes
NielsJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2012

I see those messages regularly when stopping JIRA. Do they happen during service or right before a shutdown?

Our JIRA runs without such problems many weeks on a Tomcat 6.0.32. How much heap/permgen memory have you assigned to the JVM? We have no problems with 1.2G heap, 0.5G permgen for an instance with about 100 users and 50 projects.

Radek Kantor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2012

Hi, we can increase the memory, but this is not the solution of the Tomcat 6 ThreadLocal problem. Mayby problem disappear.

Our current setting is: 256MB permgen, -Xms128m -Xmx512m for about 50 projects, but 2050 users

NielsJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2012

Xmx 512 seems a bit low. But if there aren't to many concurrent requests that may be sufficient. Do you monitor the memory usage? If it is always in the upmost fifth (over 400m) you should increase the heap memory.

As far as I understand the logmessages, Tomcat just detects possible memory leaks within the webapps such as JIRA. So in fact not Tomcat seems to have leaks, but JIRA does. There even is an issue for that: https://jira.atlassian.com/browse/JRA-24001

Maybe you get a more accurate answer when you raise a support request at Atlassian. I am interested in an explanation, too :-)

Radek Kantor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2012

Atlassian help was increase the memory and howto link: http://confluence.atlassian.com/display/JIRA/Increasing+JIRA+Memory#IncreasingJIRAMemory-guidance

Conversation thread is in process :) maybe they help me.

Tomcat6 process consule about 740MB.

Suggest an answer

Log in or Sign up to answer