This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson, oefe
Date 2008-12-17.21:44:31
SpamBayes Score 1.110223e-16
Marked as misclassified No
Message-id <1229550273.99.0.143068922247.issue4397@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for the report.  I can reproduce this both on the py3k branch and the trunk.  It looks as though there's a race condition 
in the testShutDown/_testShutDown pair of methods in SocketConnectedTest.  If you add the line

time.sleep(0.01)

to the middle of the _testShutDown method in test_socket.py (between the self.serv_conn.send() and the self.serv_conn.shutdown), 
you'll probably find that this random occasional failure becomes a 99.9% reliable failure.

As far as I can tell, this is just a bug in test_socket itself, rather than a problem with the socket module.  I also can't see 
any reason why it should be Mac specific, but I don't have anything else handy to test on right now.

Suggested fix:  don't let testShutDown exit until after _testShutdown has executed the shutdown method.  Use a threading Event to 
make this work.  The attached patch (against the trunk) appears to fix the problem for me.  Martina, if you're in a position to 
test the patch, feedback would be welcome.

It would be good if someone could review this for sanity;  I'm a complete novice when it comes to threading (and sockets, for that 
matter).
History
Date User Action Args
2008-12-17 21:44:34mark.dickinsonsetrecipients: + mark.dickinson, oefe
2008-12-17 21:44:33mark.dickinsonsetmessageid: <1229550273.99.0.143068922247.issue4397@psf.upfronthosting.co.za>
2008-12-17 21:44:33mark.dickinsonlinkissue4397 messages
2008-12-17 21:44:31mark.dickinsoncreate