Creating threadpool and then daemonizing leads to uninformative hangs or crashes

[email protected] Thu, 04 Mar 2010 13:26:32 -0000
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from ivank <[email protected]>:

At least two users created a `ThreadPool` for their `WSGIResource`, but they wrote their .tac files so that the `ThreadPool` was instantiated before `twistd` daemonized. After `twistd` daemonized, they experienced that their WSGIResource was unresponsive or that twistd crashed. I *think* there's an example of a incorrectly-written .tac file at http://paste.pocoo.org/show/185480/ (note the strace linked below is from different code)

{{{
<mezo> I run django on twisted 10.0.0, I observe strange behaviour. If twistd is a daemon : http request hang under linux (twistd crash under mac os X), whereas when twistd isn't daemonize everything works correctly. 
<mezo> more information here http://pastebin.com/VaRcLyeR (with strace output)
}}}

Assuming my diagnosis is correct (I made some assumptions), it would be nice if there were an informative error message printed at some point. For example, before forking to daemonize, twistd could raise an error if the process owns threads. If this is impractical, this bug might just be a documentation bug.

----------
Type     : defect
Component: core
Keywords : threads
Priority : high
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/4347