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

Alan Bateman Alan.Bateman at oracle.com
Thu Dec 16 13:01:10 UTC 2010


Neil Richards wrote:
> Hello.
>
> I have a fix and testcase for problem 6934356 in the Java bug database
> - "Vector.writeObject() synchronization risks serialization deadlock".
> I've included the 'hg diff -g' output below.
>   
I've looked at the patch and don't see anything obviously wrong. I think 
Mike might is looking at it too. It clearly comes with a performance 
cost of course.  One small comment is that the fields are partly 
populated in the synchronized block and partly outside. It might be 
cleaner to take a copy of the capacity increment and element count in 
the synchronized block and then set all the fields together outside. 
Another minor comment is the "final"s don't seem to be needed.

On the test case, it needs the GPL header. There are templates in the 
repository and you'll also see tests contributed by RedHat and Google if 
that helps. Another thing to mention is that hard-coded timeouts are 
problematic. In this case a 1s timeout might not be sufficient when on a 
machine that is running many tests concurrently. One suggestion is to 
just leave the threads deadlock and the test will timeout and fail if 
the bug exists. 

-Alan.






More information about the core-libs-dev mailing list