Sunbug 6934356: Vector.writeObject() synchronization risks serialization deadlock

Brian Goetz brian.goetz at oracle.com
Wed Jan 12 16:22:14 UTC 2011


Yes, that's the one.  Nothing to do with serialization, just a plain old 
deadlock.  I believe this can happen with ordinary collections wrapped 
with synchronizedXxx() as well?  But I don't think these admit an easy fix.

On 1/11/2011 8:47 AM, Alan Bateman wrote:
> Brian Goetz wrote:
>> While on the subject of serialization deadlocks in core libraries, Amy
>> Williams and Mike Ernst did a paper (also became Amy's masters thesis)
>> back when Mike was at MIT on static detection of deadlocks and they
>> built a tools which found several deadlocks in the JDK collections.
>> Does anyone recall any bugs from this source being fixed?
> I don't have history in this area but I see her M.Sc. is online and sure
> enough, in section 6.1.1 "As an example, consider java.util.Hashtable.
> This class can be deadlocked by creating two Hashtable objects and
> adding each as an element of the other, i.e., by forming a cyclic
> relationship between the instances." and further on, "all synchronized
> Collections and combinations of such Collections (e.g., a Vector in a
> cyclic relationship with a Hashtable) can be dead- locked in a similar
> fashion". Looks like she was running with JDK 1.4 but I don't think
> legacy Hashtable or Vector have changed much since then. I see someone
> actually ran into this with j.u.Properties:
> 6582568: (coll) Concurrent Hashtable.equals deadlock
>
> -Alan.



More information about the core-libs-dev mailing list