Python becoming orphaned over ssh

David wizzardx at
Thu Sep 30 15:08:08 CEST 2010

On Wed, Sep 29, 2010 at 6:49 PM, John Nagle <nagle at> wrote:
>   Python's signal handling for multithread and multiprocess programs
> leaves something to be desired.

Thanks for the confirmation (that I'm not missing something obvious).

I've reported a bug for this behavior in the Python issue tracker.

In the meanwhile, I've made a workaround function called
"check_call_and_monitor_ppids", that behaves like
subprocess.check_call, except that it regularly checks if the parent
pid "chain" (up to init process) changes during execution, and then
terminates the subprocess and raises an exception.

Actually I tried this before, and it didn't work. But strangely, it
seems to work fine so long as I don't try to print any warning
messages to stderr or stdout from the Python script (though, the
called tool itself may print to stdout or stderr without problems).
Quite peculiar...

Anyway, I hope that one of the Python developers will fix this sometime.


More information about the Python-list mailing list