Note that there are some explanatory texts on larger screens.

plurals
  1. POPython multiprocessing Process crashes silently
    primarykey
    data
    text
    <p>I'm using Python 2.7.3. I have parallelised some code using subclassed <code>multiprocessing.Process</code> objects. If there are no errors in the code in my subclassed Process objects, everything runs fine. But if there are errors in the code in my subclassed Process objects, they will apparently crash silently (no stacktrace printed to the parent shell) and CPU usage will drop to zero. The parent code never crashes, giving the impression that execution is just hanging. Meanwhile it's really difficult to track down where the error in the code is because no indication is given as to where the error is.</p> <p>I can't find any other questions on stackoverflow that deal with the same problem.</p> <p>I guess the subclassed Process objects appear to crash silently because they can't print an error message to the parent's shell, but I would like to know what I can do about it so that I can at least debug more efficiently (and so that other users of my code can tell me when they run into problems too).</p> <p><strong>EDIT:</strong> my actual code is too complex, but a trivial example of a subclassed Process object with an error in it would be something like this:</p> <pre><code>from multiprocessing import Process, Queue class Worker(Process): def __init__(self, inputQueue, outputQueue): super(Worker, self).__init__() self.inputQueue = inputQueue self.outputQueue = outputQueue def run(self): for i in iter(self.inputQueue.get, 'STOP'): # (code that does stuff) 1 / 0 # Dumb error # (more code that does stuff) self.outputQueue.put(result) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload