This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients neologix, vstinner
Date 2011-06-26.00:27:10
SpamBayes Score 8.700052e-11
Marked as misclassified No
Message-id <1309048031.56.0.168905710577.issue12413@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-06-26 00:27:11vstinnersetrecipients: + vstinner, neologix
2011-06-26 00:27:11vstinnersetmessageid: <1309048031.56.0.168905710577.issue12413@psf.upfronthosting.co.za>
2011-06-26 00:27:11vstinnerlinkissue12413 messages
2011-06-26 00:27:10vstinnercreate