Closed GoogleCodeExporter closed 9 years ago
Original comment by cgdecker@google.com
on 9 Oct 2013 at 1:53
When deploying web applications which use guava cache on tomcat 7 and restart
it, tomcat's memory leak detection is reporting the issue, too:
SEVERE: The web application [/context] created a ThreadLocal with key of type
[com.google.common.cache.Striped64.ThreadHashCode] (value
[com.google.common.cache.Striped64$ThreadHashCode@140980f]) and a value of type
[com.google.common.cache.Striped64.HashCode] (value
[com.google.common.cache.Striped64$HashCode@1bf17fe]) 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.
Original comment by patric.r...@gmail.com
on 28 Oct 2013 at 4:25
IIUIC the problem is the chain Thread -> ThreadHashCode -> Striped64$HashCode
-> class loader. Here the HashCode is nothing but a mutable int holder, so
maybe int[1] should do. There's still the problem with subclassing ThreadLocal
and ThreadHashCode.initialValue, which can be solved by handling it manually
(when get() return null, initialize it with new int[aNonZeroRandomNumber]).
Just an ugly idea.
Original comment by Maaarti...@gmail.com
on 29 Oct 2013 at 6:12
Original comment by cgdecker@google.com
on 29 Oct 2013 at 5:51
I was asked to propose my patch here, so I'm attaching it. It does exactly what
I described above.
Original comment by Maaarti...@gmail.com
on 7 Nov 2013 at 10:21
Attachments:
To the developers: half a year passed - any news regarding this?
Original comment by patric.r...@gmail.com
on 19 Apr 2014 at 1:44
Original comment by lowas...@google.com
on 29 Apr 2014 at 4:38
Original comment by kak@google.com
on 29 Apr 2014 at 5:08
Doug fixed this upstream for us and we patched it back into Guava:
http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166e/Striped64.java?r
evision=1.9
Thanks for digging this up!
Original comment by kak@google.com
on 6 May 2014 at 3:27
Original comment by cgdecker@google.com
on 5 Aug 2014 at 10:32
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<issue id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:12
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:08
Original issue reported on code.google.com by
patric.r...@gmail.com
on 9 Oct 2013 at 1:47