[Spread-users] Java library synchronization issues?

Daniel Marques marques77 at gmail.com
Fri Mar 7 21:05:40 EST 2008


I believe I'm observing two synchronization issues with the 4.0.0 Java
library and wanted to know if anyone else had seen these or if I am
confused.

First, if a listener thread were to get to line 1814 of
SpreadConnection.java, it would call SpreadConnection.remove(),
located at line 1564.  It could then execute line 1595, a call to
stopListener(), on line 1490.  From there it would reach 1499, where
it would attempt to call join on itself.

Having a thread call join() on itself is leads to a 'wait forever situation'.


Second, if a (assume a non-listener) thread were to call
SpreadConnection.disconnect(), it would grab the 'lock' on the
SpreadConnection, and then reach the stopListener() call on line 984.
It would then proceed to line 1499 and wait for the join on the
listener thread to complete.  The listener thread could return from
its yield() on line 1824 and loop back to line 1663, where it would
attempt it would block, waiting for the 'lock' on the
SpreadConnection, before it could proceed to line 1680 and exit.  As
the other thread holds that lock, a deadlock occurs.




More information about the Spread-users mailing list