CDV ❯ Possible thread leak for distributed cache instances
-
Bug
-
Status: Resolved
-
2 Major
-
Resolution: Won't Fix
-
-
-
teck
-
Reporter: teck
-
July 27, 2009
-
0
-
Watchers: 2
-
September 06, 2013
-
September 06, 2013
Attachments
Description
NOTE: There is already a test for this checked in and disabled (org.terracotta.cache.DistributedCacheGCTest)
When a distributed cache instance becomes shared (see postCreate methods in class spec), we start the evictor thread. The problem is that thread has a strong reference to the underlying map and will keep the map on the heap until the thread dies. A map that is flushed/faulted repeatedly might keep more stuff in memory than desired (not to mention evictor threads). I think the fix is have the thread weakly reference the underlying map, but some tests are in order.
This fix is really part of the larger discusion of whether we can remove the start() call from the distributed cache API. I think we can change the “local” implementation to start the thread on the first mutation. The distributed implementation already works automatically (albeit with this bug)
Comments
Alex Miller 2009-09-01
Tim Eck 2009-09-01
Good to see start() was removed. I know I wrote the description of this bug, but getting rid of start() doesn’t really affect this, it’s just the same general area.
Fiona OShea 2010-01-26
Is this still an issue?
Tim Eck 2010-02-25
This is not a complete patch but since I need to work on something else I want to save my work in progress here
Fiona OShea 2010-11-02
Is this still an issue?
Tim Eck 2010-11-02
geez, I dunno really. I think it is worth reviewing to find out for sure (some day)
Related to the second question, I actually did remove the start() method and change the local implementation to start on mutation when I reworked the DistributedCache API, so that part is done.