[Twisted-Python] Deadlocks when launching processes - how to investigate?

Glyph glyph at twistedmatrix.com
Sat Feb 15 12:58:34 MST 2014


On Feb 15, 2014, at 6:38 AM, Itamar Turner-Trauring <itamar at itamarst.org> wrote:

> In this particular case, the traceback plus some googling (http://bugs.python.org/issue11768 is what I found, presumably a different bug though) suggests the bug may be something like signal handler not being re-entrant for some reason and you're getting SIGCHLD just in the C code handling SIGCHLD. Try disabling SIGCHLD and just calling "twisted.internet.process.reapAllProcesses()" a few times a second and see if that's a good workaround - if so, add a note to the bug. If that is the case you may be able to reproduce the bug by setting a SIGCHLD handler and then sending SIGCHLD to the process a lot, no Twisted involved.

This was also my reading of the stack trace.  Thanks for finding the reference in the Python bug tracker.

The one thing that confused me was that the sample program appeared to be running the program only once a second, and waiting for it to complete before running it again.  So how would the signal handler be re-entrant?  Perhaps 'pmset' runs a subprocess of its own so that the parent process receives two SIGCHLDs?

It looks like this fix might have been included in 2.7.6, since it was fixed on the 2.7 branch.  Has it been?

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20140215/75f8466b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4124 bytes
Desc: not available
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20140215/75f8466b/attachment.bin>


More information about the Twisted-Python mailing list