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

Adi Roiban adi at roiban.ro
Wed Sep 3 11:25:50 MDT 2014


Just for reference: For the gkt2 reactor problem I found this bug
report https://twistedmatrix.com/trac/ticket/5289 ... I guess that
there is a problem with gtk2 and spawnProcess

On 3 September 2014 16:27, Adi Roiban <adi at roiban.ro> wrote:
> On 3 September 2014 14:39,  <exarkun at twistedmatrix.com> wrote:
>> On 01:05 pm, adi at roiban.ro wrote:
>>>
>>> On 2 September 2014 14:50,  <exarkun at twistedmatrix.com> wrote:
>>>>
>>>> On 01:38 pm, jmp at editshare.com wrote:
>>>>>
>>>>>
>>> [snip]
>>>>>
>>>>>
>>>>> Without my workaround, I continue to have the problem with the
>>>>> gtk2reactor.
>>>>
>>>>
>>>> Have you reported this bug?
>>>>
>>>> Jean-Paul
>>>
>>>
>>> In my initial use case, signal handlers were not installed since I
>>> wanted a custom behaviour for SIGINT, SIGTERM, SIGBREAK so that I can
>>> use my custom Unix Daemon and Windows Service adapters.
>>>
>>> I understand why reactor.run has the installSignalHandlers argument.
>>>
>>> Do you think it would make sense to have some kind of public API which
>>> would skip handlers for SIGINT, SIGTERM, SIGBREAK (as they only do
>>> reactor.stop())  but would install the SIGCHLD handler?
>>
>>
>> Yes.  Providing more fine-grain control over signal handlers would be a fine
>> improvement.
>
> Do you have any suggestion for how the calls should be made?
>
> reactor.run(installSignalHandlers=True,  installStopHandlers=False)
>
> or
>
> reactor.installStopHandlers = False
> reactor.run()
>
>
>> Another fine improvement would be making child processes work even if a
>> SIGCHLD handler cannot be installed (for example, by polling children
>> periodically, by using wait() in a sidecar process, or by using a better
>> system-specific child process monitoring API (eg kqueue's EVFILT_PROC)).
>>
>
> I see that GlibReactorBase inherits from PosixReactorBase so it should
> install the SIGCHLD handler... this should not be the reason why gtk2
> reactor don't work.
>
> As a poor man's fix and Unix independent fix maybe we can call
> reapAllProcess in a task.LoopingCall...
> What are the reasons why SIGCHLD handler cannot be installed?
>
> I am asking since I hope it could help me understant where and how to
> enable the poor man's fix... and how to fill the bug report.
>
>  kqueue's EVFILT_PROC would be great, but I guess that we still need a
> general fix
>
> ---------
>
> For the record: Right now, to ignore SIGINT, SIGTERM, SIGBREAK handles
> but keep SIGCHLD I do:
>
> # Patch base reactor to not install SIGINT, SIGTERM and SIGBREAK handlers
> _SignalReactorMixin._handleSignals = lambda self: None
> reactor.run()
>
>
> --
> Adi Roiban



-- 
Adi Roiban




More information about the Twisted-Python mailing list