Bryce Allen <o...@bda.ath.cx> added the comment:

I encountered this issue when trying to exit cleanly on SIGTERM, which I use to 
terminate background daemons running serve_forever.

In BaseServer, a threading.Event is used in shutdown, so it can block until 
server_forever is finished (after checking __serving). Since the SIGTERM 
interrupts the select system call, the event set is never reached, and shutdown 
hangs waiting on the event.

I've attached an example of the pattern I was trying to use in my server. There 
are several ways around the issue, but looking at the API it seems like this 
_should_ work, and in my experience all servers have clean-up code so it's a 
very common case.

----------
nosy: +bda
Added file: http://bugs.python.org/file17120/sockServe.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7978>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to