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 paul.moore
Recipients paul.moore
Date 2010-04-30.09:18:00
SpamBayes Score 0.01552463
Marked as misclassified No
Message-id <1272619084.25.0.373754420183.issue8576@psf.upfronthosting.co.za>
In-reply-to
Content
test_support.find_unused_port attempts to find an unused port to use. The approach is fragile (as noted in the docstring) in certain cases. In particular, it appears that Windows takes a short time to free the socket after it is closed, meaning that when the caller tries to open a socket on the returned port number, it gets permission issues.

A sleep(0.1) just before returning the port number appears to address the issue, but this is not a proper solution.

http://msdn.microsoft.com/en-us/library/ms737582%28v=VS.85%29.aspx describes the SO_LINGER and SO_DONTLINGER socket options, which may be related, but in my initial tests I haven't been able to get these to work.
History
Date User Action Args
2010-04-30 09:18:06paul.mooresetrecipients: + paul.moore
2010-04-30 09:18:04paul.mooresetmessageid: <1272619084.25.0.373754420183.issue8576@psf.upfronthosting.co.za>
2010-04-30 09:18:02paul.moorelinkissue8576 messages
2010-04-30 09:18:00paul.moorecreate