Ticket #5151 defect new
_SIGCHLDWaker in twisted.internet.posixbase doesn't check its pipe is still open when registering signal handlers
| Reported by: | hodgestar | Owned by: | hodgestar |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Keywords: | |
| Cc: | itamar@… | Branch: |
branches/process-exited-errors-5151
(diff, github, buildbot, log) |
| Author: | hodgestar | Launchpad Bug: |
Description
The function install in _SIGCHLDWaker looks like:
def install(self):
"""
Install the handler necessary to make this waker active.
"""
_signals.installHandler(self.o)
Here self.o may evaluate to None causing installHandler to throw an exception. This may happen if connectionLost is somehow called before installHandler.
One possible fix is:
def install(self):
"""
Install the handler necessary to make this waker active.
"""
if self.o is not None:
_signals.installHandler(self.o)
I've observed this in the wild inside a moderately complex test suite. Assistance in understanding the "somehow" that causes self.o to become None would be appreciated.
The following note inside _handleSignals in posixbase might be relevant since it explains one possible scenario in which related code may be executed before the event handlers are installed:
# Also reap all processes right now, in case we missed any # signals before we installed the SIGCHLD waker/handler. # This should only happen if someone used spawnProcess # before calling reactor.run (and the process also exited # already).
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

