[Python-Dev] 2.4 asyncore headache

Nick Coghlan ncoghlan at iinet.net.au
Sat Aug 14 09:40:18 CEST 2004


Tim Peters wrote:

> [Nick Coghlan]
> 
>>A couple of days ago I ran the test suite with -unetwork, and that test
>>failed, but I haven't got around to looking into it yet. Could this be
>>related?
> 
> 
> Which OS?  asyncore isn't involved in that test, so the patch could
> not have affected it.  SocketServer.py has its own, separate code
> using SO_REUSEADDR in some cases.

Ah, OK, it was just a thought. I'm on Windows XP SP1, and it's 
consistently choking on the second attempt to test the UDP Server:

==Test=Output==
[snipped output from TCP tests]
ADDR = ('localhost', 12963)
CLASS = SocketServer.UDPServer
server created
thread: creating server
server running
thread: serving three times
test client 0
test client 1
test test_socketserver failed -- test failed
1 test failed:
     test_socketserver
^C
==End=Test=Output==

The Ctrl-Break comes from the fact that the test hangs at that point 
without exiting. 'netstat -a' shows that there isn't anything using 
anything even close to those port numbers.

I plan to do some more poking to try and narrow down a bit further what 
is going on before going to SF with it. (There are 5 different network 
connections on this laptop, including a virtual one to the Linux 
install, so I wouldn't be surprised if there is something odd going on 
with the network interface)

> It also says:
> 
>     This is only a problem on multi-user machines that don't have restricted
>     logins, it is NOT a vulnerability from outside the machine. And it is easily
>     avoided by binding your server to the machine's address.
> 
> If you're running a server on an open Windows machine, worrying about
> details of socket reuse may not be the best use of your security time
> <wink>.

Indeed. I think it suggests that continuing to use SO_REUSEADDR normally 
on Windows is the best option for ayncore, though.

Windows users just need to be aware that it doesn't mean quite the same 
thing as it does on a Unix-like system (actually, some of the other 
Google hits made me wonder if it really means the same thing in all the 
different Unix variants in the first place. . .)

Regards,
Nick.

-- 
Nick Coghlan               |  Eugene, Oregon
Email: ncoghlan at email.com  |             USA


More information about the Python-Dev mailing list