This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author teamnoir
Recipients teamnoir
Date 2012-01-09.19:19:28
SpamBayes Score 2.9031094e-06
Marked as misclassified No
Message-id <1326136769.56.0.386749729049.issue13749@psf.upfronthosting.co.za>
In-reply-to
Content
Once I've instantiated my server class, along with a handler class, called server.serve_forever(), handler.handle() has been called, I've done my work, and I'm ready to shut the whole thing down...

How do I do that?

The doc says server.shutdown(), but if I call self.server.shutdown() from within handler.handle(), I seem to get a deadlock, which is exactly what I'd expect in a single threaded system with no way to "signal" the server.server_forever() loop which is several frames up the stack.

I've also tried sys.exit() but it seems that the server object is catching that as an exception.

How is this expected to work?  How do I terminate the server.serve_forever() loop?

Both 3.2 and 2.7 appear to behave the same way.  The documentation is confusing here as it doesn't explain what is expected to happen in this case.
History
Date User Action Args
2012-01-09 19:19:29teamnoirsetrecipients: + teamnoir
2012-01-09 19:19:29teamnoirsetmessageid: <1326136769.56.0.386749729049.issue13749@psf.upfronthosting.co.za>
2012-01-09 19:19:28teamnoirlinkissue13749 messages
2012-01-09 19:19:28teamnoircreate