SocketServer shutdown deadlock

Okko Willeboordse trash at willeboordse.demon.nl
Thu Nov 6 09:29:20 EST 2008


All,

With Python 2.5 SocketServer features the shutdown method that can be
called from another thread to stop the serve_forever loop.

However;

When the shutdown method is called before serve_forever, shutdown will
never return.
This can happen when a server is stopped during startup.

In other words, the following program shouldn't hang but it does;

import SocketServer

server = SocketServer.ThreadingTCPServer(("127.0.0.1", 12345),
SocketServer.BaseRequestHandler)
server.shutdown()

What to do?



More information about the Python-list mailing list