New submission from Paul Moore <p.f.mo...@gmail.com>: 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. ---------- components: Tests, Windows keywords: buildbot messages: 104614 nosy: pmoore priority: normal severity: normal status: open title: test_support.find_unused_port can cause socket conflicts on Windows _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8576> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com