Menu

#13 Deadlock possible in SimpleSmtpServer.start()

open
nobody
None
7
2005-11-11
2005-11-11
No

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.

Discussion

  • Rhett Sutphin

    Rhett Sutphin - 2005-11-11

    Patch to eliminate the deadlock possiblity

     
  • Rhett Sutphin

    Rhett Sutphin - 2005-11-11
    • priority: 5 --> 7
     
  • Rhett Sutphin

    Rhett Sutphin - 2005-11-11

    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.

     
  • Jon Stevens

    Jon Stevens - 2006-08-11

    Logged In: YES
    user_id=234781

    Use SubEtha SMTP Wiser project instead. It's a nice
    replacement for Dumbster.

    http://subethasmtp.tigris.org

     
  • Eric Brown

    Eric Brown - 2006-08-14

    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.

     

Log in to post a comment.