[Twisted-Python] Freezing Ampoule or the Invasion of Infinite Zombie Processes
Glyph Lefkowitz
glyph at twistedmatrix.com
Mon Mar 10 12:36:02 MDT 2014
On Mar 9, 2014, at 12:31 AM, Burak Nehbit <burak at nehbit.net> wrote:
> I agree. Though it’s also very useful as an drop–in implementation of a Twisted spawnProcess for one single other process.
>
spawnProcess is somewhat low-level. It would be very nice indeed if Twisted had some sort of Service object you could easily use for spawning worker processes, along the lines of Ampoule, that would take care of all the platform-specific nonsense of setting up communication with subprocesses, spawning them, monitoring them, figuring out the right Python to spawn, the right environment variables to get sys.path correct, and other things, such as...
>> It sounds like the basic process support included in Twisted,
>> reactor.spawnProcess, could address your requirements.
>
> I have just found your answer here:
>
> https://stackoverflow.com/questions/6678763/simple-example-with-spawnprocess
>
> which seems useful. If nothing else works, I will try to reduce complexity by converting this to bare spawnProcess.
>
> Any ideas on what might be going wrong in my current stack? After all, processes being repeatedly created is just a symptom of something going wrong in the process very early, so ampoule tries to spawn another one. I am mainly looking to find a way to see the exception and where it happens. Twisted’s logging module seem to kick in too late.
>
Twisted's logging typically gets initialized after all modules are imported. A tool like Ampoule really ought to set up logging as early as possible in its child, and handle the case where it's not getting set up on the parent side.
The important thing to do is to make sure you have an errReceived callback that actually prints or logs the stderr it receives; there's likely a traceback in there which you may have missed if the process is just crashing.
-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20140310/43c33bb3/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4124 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20140310/43c33bb3/attachment-0002.bin>
More information about the Twisted-Python
mailing list