Return-Path: X-Original-To: apmail-logging-log4j-user-archive@www.apache.org Delivered-To: apmail-logging-log4j-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DAD84186C0 for ; Fri, 18 Dec 2015 00:08:56 +0000 (UTC) Received: (qmail 24013 invoked by uid 500); 18 Dec 2015 00:08:51 -0000 Delivered-To: apmail-logging-log4j-user-archive@logging.apache.org Received: (qmail 23962 invoked by uid 500); 18 Dec 2015 00:08:51 -0000 Mailing-List: contact log4j-user-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Users List" Reply-To: "Log4J Users List" Delivered-To: mailing list log4j-user@logging.apache.org Received: (qmail 23951 invoked by uid 99); 18 Dec 2015 00:08:51 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Dec 2015 00:08:51 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 165161A128C for ; Fri, 18 Dec 2015 00:08:51 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.901 X-Spam-Level: ** X-Spam-Status: No, score=2.901 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 4UXG8nQ04x6P for ; Fri, 18 Dec 2015 00:08:37 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 2634C201A4 for ; Fri, 18 Dec 2015 00:08:37 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id y184so62456685lfc.1 for ; Thu, 17 Dec 2015 16:08:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=k2MSn5ids5SOU+HIVBfhdrDzg7kuexlVskVREWKPg4w=; b=nJeDbbWYqQkGSLgTuU9ongvDqWKMMzezrkclRRogdwKNA+1cx6Qt5bYLVrSGIqagWk uTF/a6ezSxlGT8KfAfYDnGB+3uUThFiLGUSn4R+6ymDJO8WDQAbE/uuxQLdhZ0jsKw4s 6eO9fCYI/ySQNzgBWqvG8DEOM/siZlJH4X1lHIMImbZwGsy1lozF6XGkGhY4OOHsMVhT /aO75RECLjI87q+zi6e0DE1uS41HTFSm/lmI0zPd7HjRMOlHGHeKTFjV1bxk2vai+BGJ vUwHTmOH9TiJPx9ttHxQjXJNQmcBzq9ZIYIim5aoHdYAM1N+hG0f2uwQQfo39F9wlSxG +mbA== MIME-Version: 1.0 X-Received: by 10.25.39.19 with SMTP id n19mr156785lfn.156.1450397316171; Thu, 17 Dec 2015 16:08:36 -0800 (PST) Received: by 10.112.200.70 with HTTP; Thu, 17 Dec 2015 16:08:36 -0800 (PST) In-Reply-To: <504377321.459652.1450397049960.JavaMail.yahoo@mail.yahoo.com> References: <504377321.459652.1450397049960.JavaMail.yahoo@mail.yahoo.com> Date: Thu, 17 Dec 2015 16:08:36 -0800 Message-ID: Subject: Re: still: Memoryleak - org.apache.log4j.helpers.ThreadLocalMap From: Gary Gregory To: Log4J Users List , Dave Glasser Content-Type: multipart/alternative; boundary=001a1141072cd057b2052720f07d --001a1141072cd057b2052720f07d Content-Type: text/plain; charset=UTF-8 FYI: I'm pretty sure we will not see a 2.3 branch maintained at parity with master, I do not see anyone here so far that has expressed interest in such an effort. If you'd like to help out, you are more than welcome to do so. There is a possibility for a 2.3.x branch to backport selected fixes though, again, help wanted. Aside from that my efforts focus on master. Gary On Thu, Dec 17, 2015 at 4:04 PM, Dave Glasser wrote: > The bugs don't matter, because, as I mentioned, the main blocker for me in > the 2.x branch is that I need to ability to programmatically configure > log4j, and change the configuration at runtime. It might get there, in fact > 2.5 might be there, but Java 1.7 is a no-go for me. > If you guys are going to actively maintain a Java 1.6-compatible branch > that's forked from log4j 2.3, my suggestion would be to keep all the bug > fixes and functionality aligned with the main branch, except for the lamda > stuff that doesn't work under Java 1.6. But that's just a suggestion. I'll > be sticking with the 1.2.x branch for the foreseeable future. > > > > From: Gary Gregory > To: Log4J Users List ; Dave Glasser < > dglasser@pobox.com> > Sent: Thursday, December 17, 2015 6:32 PM > Subject: Re: still: Memoryleak - org.apache.log4j.helpers.ThreadLocalMap > > Can you list which bugs in JIRA you'd like to have in what could possibly > be a 2.3.1 release? > > Gary > > On Thu, Dec 17, 2015 at 2:57 PM, Dave Glasser wrote: > > > Unfortunately, in addition to the bugs in 2.3, there is missing > > functionality that precluded me from using it. (The programmatic > > configuration features I posted about in the last week or so.) > > If there isn't currently any actively maintained branch that supports > 1.6, > > I'll have to work around it some other way. > > > > > > > > From: Gary Gregory > > To: Dave Glasser ; Log4J Users List < > > log4j-user@logging.apache.org> > > Sent: Thursday, December 17, 2015 3:16 PM > > Subject: Re: still: Memoryleak - org.apache.log4j.helpers.ThreadLocalMap > > > > Hello, > > > > Log4j 1 has reached EOL. For Java 6 support you can use 2.3. > > > > Gary > > On Dec 17, 2015 11:30 AM, "Dave Glasser" wrote: > > > > > To any Log4j devs on the list, if Veit has found a bug in 1.2.17, > please, > > > please, fix it and release 1.2.18. I cannot use 2.5 because my code has > > to > > > run under Java 1.6. I suspect that is the case with a lot of developers > > who > > > deploy on WebSphere or WebLogic. > > > > > > > > > > > > From: Veit Guna > > > To: log4j-user@logging.apache.org > > > Sent: Thursday, December 17, 2015 12:36 PM > > > Subject: still: Memoryleak - org.apache.log4j.helpers.ThreadLocalMap > > > > > > Hi. > > > > > > We're developing a Jersey 2(.22.1) REST service with JDK8, log4j 1.2.16 > > > and SLF4J 1.7.7 using Tomcat 8.0.23. > > > > > > Recently I stumbled across the problem mentioned here: > > > > > > https://bz.apache.org/bugzilla/show_bug.cgi?id=50486 > > > > > > Where Tomcat complains about left behind ThreadLocalMaps. > > > > > > I updated to 1.2.17 which claims to fix the mentioned problem. > > > On first sight, it did. Starting the server and immediately stopping it > > > showed no warning anymore - before it did. Yay! > > > > > > But then I drove some loadtests against our REST service and after > > > stopping it the same message appeared again :(. > > > > > > I double checked that our MDC put/remove is performed within a > > > try/finally within a http filter. I also logged, what values > > > were put and removed from the MDC - everyting as expected. > > > I also made sure, that the key was really removed after > > > MDC.remove() by getting the key from the MDC again: null. > > > > > > Tomcat complained about a specific key/value in the ThreadLocalMap. > > > I checked, that this key/value was logged before - and it was > > > logged as "removed". So somehow it wasn't _really_ removed. > > > > > > I digged deeper into the rabbit hole and found this peace of code: > > > > > > --cut here-- > > > final public class ThreadLocalMap extends InheritableThreadLocal { > > > > > > public > > > final > > > Object childValue(Object parentValue) { > > > Hashtable ht = (Hashtable) parentValue; > > > if(ht != null) { > > > return ht.clone(); > > > } else { > > > return null; > > > } > > > } > > > } > > > --cut here-- > > > > > > At this point, the hashtable containing the key/values is cloned > > > when a child thread is spawned. That would explain, why I see that > > > the complained key/value still exists, although I removed it from the > > > MDC. It still exists in the cloned instance on the spawned child thread > > > I guess! > > > > > > I verified it by debugging within eclipse and set a breakpoint there, > > > simply returning null instead of ht.clone(). And voila: no complaining > > > anymore when shutting down. > > > > > > Since I'm not too deep into log4j, could someone of the devs please > > > shed some light on this, please? > > > > > > I'm wondering, who will remove the ThreadLocalMap on the spawned child > > > threads? Since MDC.remove() will do this only on my parent thread > > > manually kicked by the filter. > > > > > > Or, maybe I'm completely wrong with this :). > > > > > > Thanks > > > Veit > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org > > > For additional commands, e-mail: log4j-user-help@logging.apache.org > > > > > > > > > > > > > > > > > > > > -- > E-Mail: garydgregory@gmail.com | ggregory@apache.org > Java Persistence with Hibernate, Second Edition > > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > > > -- E-Mail: garydgregory@gmail.com | ggregory@apache.org Java Persistence with Hibernate, Second Edition JUnit in Action, Second Edition Spring Batch in Action Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory --001a1141072cd057b2052720f07d--