[concurrency-interest] NullPointerExceptionin ThreadLocal$ThreadLocalMap.replaceStaleEntry
mailinglist.taras.tielkes at gmail.com
Fri Jun 30 11:28:42 EDT 2006
Thomas Hawtin wrote:
> Doug Lea wrote:
>> As Joe just mentioned, there was an unsupported usage (that
>> was not clearly documented as unsupported) of initialValue
>> methods recursively creating other ThreadLocals, that was
>> addressed for Mustang, and which might conceivably cause this.
>> It might not be too hard to look in your code to see if
>> there are any cases of this. Otherwise, offhand, this looks
>> like it might be a GC bug, but no one will be able to figure
>> it out unless they can replicate.
> Looking through the source, it does appear to be Bug 5025230  as Joe
> says. However, this case is a bit more subtle than the scenario in the
> report. It appears that the nested thread-local initialisation causes
> some tidying of stale entries, which clears the slot about to be filled
> (probably on a complete rehash of the thread's table).
That would certainly make it very non-deterministic and hard to reproduce.
Now for a bit off-topic...I heard that a new implementation of
ThreadLocal will make it into Dolphin, eliminating both the lingering
stale entries, and the value->key reference path limitation. Any thuth
to this, or better, details?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest