logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50486] New: Memoryleak - org.apache.log4j.helpers.ThreadLocalMap
Date Thu, 16 Dec 2010 15:33:02 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50486

           Summary: Memoryleak - org.apache.log4j.helpers.ThreadLocalMap
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Other
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: kukudas85@googlemail.com


Tomcat 7 log's this when doing a shutdown:

The web application [/MyApp] created a ThreadLocal with key of type
[org.apache.log4j.helpers.ThreadLocalMap] (value
[org.apache.log4j.helpers.ThreadLocalMap@1d3e069]) and a value of type
[java.util.Hashtable] (value [{}]) but failed to remove it when the web
application was stopped. This is very likely to create a memory leak.

I'm using it the following way:

try {
  if (MDC.get(..) == null) {
    MDC.put(.., ...);
  }
   ....
  } finally {
     MDC.remove(...);
  }

After taking a quick look at the source of log4j i think the problem is that
remove only removes the entry from the HashTable but does not call remove on
the ThreadLocal itself.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


Mime
View raw message