[Twisted-Python] spawnProcess() works after reactor.stop()
spongelavapaul at googlemail.com
Mon Jan 19 06:09:06 EST 2009
I'm using SelectReactor on Linux for a system that spawns a lot of sub-
processes. I'm finding that there are some cases where a signal to the
twistd process doesn't reap the children and I think it's because the
SIGINT handler defers the shutdown but doesn't prevent spawnProcess()
from working in the meantime.
What's happening is the signal gets handled by calling stop(). This
sets a flag and schedules the shutdown event for later.
- Then Linux signals all the sub-processes.
- Then my code gets scheduled and spawns a process or 2.
- The shutdown event runs
The result is that any process spawned after the signal is orphaned.
So, my question is: is this a bug in the reactor (should it check
If it's a bug, I expect it's a bit more general than just processes -
would it be better to have the select loop check _stopped.
If it's not a bug, would it be possible to add a public accessor for
the stopped state so application code can decide whether to run or not?
More information about the Twisted-Python