By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

SocketServer shutdown deadlock

P: n/a
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?
Nov 6 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
If I wait until _BaseServer__serving is True before calling shutdown
things go better.

Okko Willeboordse wrote:
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?
Nov 6 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.