Deadlock possible in SimpleSmtpServer.start()
Brought to you by:
jasonkitchen
There is a possible deadlock in
SimpleSmtpServer.start() in Dumbster 1.6. On my
development machine (OS X 10.4.3, single G4), in fact,
it deadlocks more than 3/4 of the time.
The deadlock arises because it is possible for the
server thread (i.e., the one started in
SimpleSmtpServer.start()) to execute notifyAll before
the calling thread is waiting. If this happens, the
calling thread will wait forever.
The attached patch fixes this by adding a "listening"
flag that is set to true after the server socket is
opened. SimpleSmtpServer.start() polls this value and
doesn't return until it is true.
Patch to eliminate the deadlock possiblity
Logged In: YES
user_id=1135131
I just noticed that there's a patch in Patches for this same
bug:
[ 1310992 ] Racing Condition on Server Creation
That solution may be preferable since it just fixes the
wait/notify race condition instead of replacing it with a
polling wait. On the other hand, the polling wait has the
virtue of not requiring the server thread to stop if it is
outrunning the calling thread.
In the low-demand environment of a unit test, it probably
doesn't matter. Just so long as the fix works.
Logged In: YES
user_id=234781
Use SubEtha SMTP Wiser project instead. It's a nice
replacement for Dumbster.
http://subethasmtp.tigris.org
Logged In: YES
user_id=180367
This is a duplicate for 1179454 that is already fixed by patch
1310992 (as mentioned). That patch is in CVS, but is not in
any of the official releases.
It would be really nice to get a 1.7 or 1.7-SNAPSHOT onto
ibiblio.