[Buildbot-devel] p4poller: SIGCHLD handler is not installed

Brian Warner warner-buildbot at lothar.com
Wed Apr 19 04:39:18 UTC 2006


> Looks like the call tree is this (skipping some frames):
> 
> - twisted.scripts.twistd.runApp
> -- twisted.scripts.twistd.startApplication
> --- buildbot.changes.p4poller.P4Source.startService
> ---- twisted.internet.task.LoopingCall.start(..., now=True)
> ----- LoopingCall.__call__
> ------ P4Source._get_changes
> ------- twisted.internet.utils.getProcessOutput
> -- twisted.application.app.runReactorWithLogging
> 
> I can work around this problem by sticking a reactor.callLater in  
> P4Source.startService to make it wait for the reactor to start before  
> looping. Do you think this is the best solution?

Interesting problem. I guess it depends upon LoopingCall.. I think there are
versions of Twisted for which LoopingCall fires the callback right away, and
there are versions where it doesn't fire it for a full timeout duration after
it is started. (not unlike the difference between a 'while' loop and a 'do..
until' loop, I suppose).

The simplest solution would probably be for you to start the LoopingCall with
now=False. That will put off the first invocation until after the interval.

If for some reason that won't work, it's not unreasonable to use a
'reactor.callLater(0, lc.start)' to put that event off for one reactor turn.

> I kind of wonder if buildbot shouldn't be doing so much stuff before the
> reactor starts up.

Good instinct. The buildbot should not be doing anything of note before the
reactor has been started.. all the startService() calls should do is arrange
for things to happen in the near future. I consider it a bug in LoopingCall
that it likes to invoke the callback so early, really.

> Has this problem come up anywhere else?

Oh, only everywhere in the history of computer programming :-). See Mark
Miller's highly accessible article[1] (and his hot-off-the-presses thesis[2])
for details and suggested solutions. (hint: reactor.callLater(0) is the
'eventual send' operator, and is used extensively in his work).


cheers,
 -Brian

[1]: http://erights.org/talks/promises/index.html
[2]: http://erights.org/talks/thesis/index.html




More information about the devel mailing list