STINNER Victor <victor.stin...@haypocalc.com> added the comment:

Oh oh. I already thaugh to this feature, but its implementation is not trivial.

> As noted in issue #11870 ...

You mean that the tracebacks of children should be dumped on a timeout of the 
parent? Or do you also want them on a segfault of the parent? In my experience, 
the most common problem with the multiprocessing and subprocess modules is the 
hang.

The timeout is implemeted using a (C) thread in faulthandler. You can do more 
in a thread than in a signal handler ;-) A hook may be added to faulthandler to 
execute code specific to multiprocessing / subprocess.

> send a signal to its process group if the current process
> is the process group leader

In which case is Python the leader of the group? Is it the case by default? Can 
we do something to ensure that in regrtest, in multiprocessing tests or the 
multiprocessing module?

See also #5115 (for the subprocess module).

The subprocess maintains a list of the create subprocesses: subprocess.alive, 
but you need a reference a reference to this list (or you can access it using 
the Python namespace, but it requires the GIL and you cannot trust the GIL on a 
crash). 

subprocess can execute any program, not only Python. Send an arbitrary signal 
to a child process can cause issues.

Does multiprocessing maintain a list of child processes?

--

By the way, which signal do you want to send to the child processes? A test may 
replace the signal handler of your signal (most test use SIGALRM and SIGUSR1).

faulthandler.register() is not available on Windows.

--

crier ( https://gist.github.com/737056 ) is a tool similar to faulthandler, but 
it is implemented in Python and so is less reliable. It uses a different 
trigger: it checks if a file (e.g. /tmp/crier-<pid>) does exists.

A file (e.g. a pipe) can be used with a thread watching the file to send the 
"please dump your traceback" request to the child processes.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12413>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to