[Twisted-Python] spawnProcess - reapProcess not retrying on failures

Adi Roiban adi at roiban.ro
Tue Sep 2 07:31:00 MDT 2014


Problem solved... see below

On 2 September 2014 12:05, Justin Mazzola Paluska <jmp at editshare.com> wrote:
> On 09/02/2014 05:08 AM, Adi Roiban wrote:
[snip]

>         if pid:
>             self.processEnded(status)
>             unregisterReapProcessHandler(pid, self)
>         elif pid == 0:
>             # Twisted seems to get stuck if pid is 0, which means that
>             # the child process hasn't changed status, but if called
>             # after SIGCHLD probably means that the child process is
>             # in the process of dying, but hasn't quite died yet.
>             # We'll try to kick the reactor to reap the processes
>             # again in a bit.
>             #
>             # We're testing specifically against 0 because pid may
>             # also be None in an error case.
>             def unstick():
>                 reapAllProcesses()
>             reactor.callLater(1, unstick)
>
>     _BaseProcess.reapProcess = reapProcess
>
> ----
>
> To use this, import your reactor and then call
> workaround_reapProcess(reactor).
>
> Now that two of us have seen the same problem, we should probably file a
> ticket in the bug tracker.
>     --Justin

My quick fix was to only call reactor.callLater(self.reapProcess) and
not to reap all processes

----------

I dig deeper and I found out that since I was using
reactor.run(installSignalHandlers=False)  _SIGCHLDWaker was not
installed.

I have switched to using just reactor.run() and the process is now killed.

Thanks!
-- 
Adi Roiban




More information about the Twisted-Python mailing list