title: Python not raising exception after calling start on a nested multiprocessing.Process
body: <p>I have run in to an issue in my program where exceptions are not thrown after launching a nested subprocess. That is, I have a method that I run in a multiprocessing.Process. Inside of that process (&quot;the first process&quot;), I launch another multiprocessing.Process. After calling start on the second process, the first process continues but does not raise exceptions, instead hanging when an exception is raised.</p>
  <p>I cannot tell if this is expected behavior or I have stumbled across a bug in Python. Here is a minimal example to demonstrate the issue:</p>
  <pre><code>import multiprocessing as mp
  import time
  
  def spin_proc():
      while True:
          print(&quot;spin&quot;)
          time.sleep(1)
  
  def issue():
      sub_proc = mp.Process(target=spin_proc)
      sub_proc.start()
      print(&quot;Exception called next.&quot;) # This text is printed, as expected.
      raise Exception() # This exception is never raised.
      print(&quot;This text is not printed.&quot;)
  
  first_proc = mp.Process(target=issue)
  first_proc.start()
  </code></pre>
  <p>The output is:</p>
  <pre><code>$ python3 except.py 
  Exception called next.
  spin
  spin
  spin
  spin
  </code></pre>
  <p>And it will continue printing &quot;spin&quot; indefinitely until I hit Ctrl-C. I would have expected the exception to get raised and crash the program.</p>
  <p>I have confirmed this behavior in Python 3.8.10 and Python 3.9.2.</p>
  <p>Is this expected behavior? If so, why? It has the effect of hiding exceptions in my code and unexpectedly blocking, which was very frustrating when trying to debug something new and not seeing any output. If it appears to be a bug, please let me know and I will report it to the Python bug tracker.</p>
  <p>Thank you! And here is the output when pressing Ctrl-C. It seems it wanted to throw the Exception, but was hanging for some reason:</p>
  <pre><code>^CError in atexit._run_exitfuncs:
  Traceback (most recent call last):
    File &quot;/usr/lib/python3.8/multiprocessing/popen_fork.py&quot;, line 27, in poll
      pid, sts = os.waitpid(self.pid, flag)
  KeyboardInterrupt
  Process Process-1:1:
  Process Process-1:
  Traceback (most recent call last):
    File &quot;/usr/lib/python3.8/multiprocessing/process.py&quot;, line 315, in _bootstrap
      self.run()
    File &quot;/usr/lib/python3.8/multiprocessing/process.py&quot;, line 108, in run
      self._target(*self._args, **self._kwargs)
    File &quot;except.py&quot;, line 7, in spin_proc
      time.sleep(1)
  KeyboardInterrupt
  Traceback (most recent call last):
    File &quot;/usr/lib/python3.8/multiprocessing/process.py&quot;, line 315, in _bootstrap
      self.run()
    File &quot;/usr/lib/python3.8/multiprocessing/process.py&quot;, line 108, in run
      self._target(*self._args, **self._kwargs)
    File &quot;except.py&quot;, line 13, in issue
      raise Exception() # This exception is never raised.
  Exception
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;/usr/lib/python3.8/multiprocessing/process.py&quot;, line 318, in _bootstrap
      util._exit_function()
    File &quot;/usr/lib/python3.8/multiprocessing/util.py&quot;, line 357, in _exit_function
      p.join()
    File &quot;/usr/lib/python3.8/multiprocessing/process.py&quot;, line 149, in join
      res = self._popen.wait(timeout)
    File &quot;/usr/lib/python3.8/multiprocessing/popen_fork.py&quot;, line 47, in wait
      return self.poll(os.WNOHANG if timeout == 0.0 else 0)
    File &quot;/usr/lib/python3.8/multiprocessing/popen_fork.py&quot;, line 27, in poll
      pid, sts = os.waitpid(self.pid, flag)
  KeyboardInterrupt
  </code></pre>