You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2013/10/18 23:53:00 UTC

[Bug 55674] New: ThreadLocal memory leak clean-up causes huge log

https://issues.apache.org/bugzilla/show_bug.cgi?id=55674

            Bug ID: 55674
           Summary: ThreadLocal memory leak clean-up causes huge log
           Product: Tomcat 7
           Version: 7.0.42
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: ugo.scaiella@gmail.com

ThreadLocal memory leak detection code is fine, but when it tries to clean-up
ThreadLocal maps, it prints something like this in catalina.out:

Oct 18, 2013 2:32:59 PM org.apache.catalina.loader.WebappClassLoader
checkThreadLocalMapForLeaks
SEVERE: The web application [/...] created a ThreadLocal with key of type [...]
(value [...]) and a value of type [java.text.SimpleDateFormat] (value
[java.text.SimpleDateFormat@6b2ed43a]) 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.

Now, if the object contained in the ThreadLocal is very big and the toString
method dumps all the data of that object, log could become very huge. Eg, in
our application, we store a big HashMap in ThreadLocal and the trace above is
about 700Mb because it recursively calls toString methods of all objects
contained in the map.

Is it necessary to log values contained in ThreadLocal maps during clean-up
process?
Additionaly, log level for that message is set to SEVERE and there's no way to
specify logging details for that message.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55674] ThreadLocal memory leak clean-up causes huge log

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55674

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
The attribute names and values are logged to assist with the identification of
the cause of the memory leak.

Memory leaks are logged at SEVERE as they represent a serious bug that could
eventually lead to an OOME. Tomcat's leak detection and prevention code should
reduce the chances of an OOME but it may not eliminate it.

Since neither the severity level nor the use of toString() is going to change,
I am resolving this as WONTFIX.

That said, there is a long standing enhancement request (bug 50715) to modify
the leak detection code so the warnings are skipped / logged at a lower level
when the leaks don't matter (e.g. when the JVM is shutting down).

Some recent work on a unrelated issue means I have some useful info to add to
that bug so I'll do that shortly. I'll add 50715 to my TODO list as the
features it requires are likely to be useful elsewhere.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55674] ThreadLocal memory leak clean-up causes huge log

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55674

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 55674] ThreadLocal memory leak clean-up causes huge log

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55674

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Whoops, I mean bug 50175.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org