Open GoogleCodeExporter opened 9 years ago
Anybody on this one?
Original comment by christop...@gmail.com
on 20 Jul 2012 at 5:19
This is the localContext ThreadLocal from InjectorImpl - this is actually an
array of Objects, length 1, which holds the internal context while processing
nested injection requests. The content of this array is nulled out when the
outermost call completes, and it is only referenced from inside the injector,
so technically there is nothing to stop the GC from collecting this chain. See
http://blog.crazybob.org/2006/07/hard-core-java-threadlocal.html for the
overall approach. However, due to a long-standing bug in the JDK's ThreadLocal
design this entry may still appear in the thread's internal book-keeping map
that Tomcat introspects. The entry should disappear after more ThreadLocals are
created, as this then mutates the book-keeping map which clears the entry.
So if you are hot-deploying applications then this shouldn't cause a leak in
practice, it's just the eager Tomcat detector warning about a potential leak
based on it's internal introspection. There are ways we could force an
immediate cleanup of the entry, but the downside is that this could then affect
performance for everyone while fixing a theoretical issue.
Original comment by mccu...@gmail.com
on 20 Jul 2012 at 5:53
The attached patch (which I attached yesterday to issue 288) should also clear
up this warning.
Original comment by mccu...@gmail.com
on 7 Aug 2012 at 6:56
Attachments:
Original comment by sberlin
on 5 Dec 2013 at 11:51
Original issue reported on code.google.com by
christop...@gmail.com
on 2 Jun 2012 at 6:25