Sockets left in TIME_WAIT state ???

Gordon McMillan gmcm at hypernet.com
Sun Mar 5 08:42:27 EST 2000


Philip Payne <pnpayne at swissonline.ch> wrote:
>
>Hi,
>
>I'm brand new to sockets, in Python or otherwise, and I'm 
wondering whether
>anyone else has experience of sockets not being cleaned up 
correctly (left
>in TIME_WAIT state, whatever that means).

>It's easy to demonstrate on just one machine using the example 
programs in
>the HTML documentation for the socket module.


>Is this normal socket behaviour, a bug in the networking software 
or a bug
>in the socket module that I should report???

It's an incompleteness in the example server. 

The server accepts exactly one connection in it's lifetime, and 
loops until that connection until it closes. But it never closes the 
"server" socket (the one that did the accept). 

So the server procss goes away, leaving a an oustanding IO 
request. Add a "s.close()" and the problem will go away.




More information about the Python-list mailing list