[issue39763] distutils.spawn should use subprocess (hang in parallel builds on QNX)

Guido van Rossum report at bugs.python.org
Wed Feb 26 18:02:14 EST 2020


Guido van Rossum <guido at python.org> added the comment:

When I run this on macOS, either with the bug, or with the buggy line commented out, I get the same hang. When I interrupt it, I get
 a separate traceback from each thread. Here's the full session:

Parent 78918
Parent 78919
Child 78918
Parent 78920
Child 78919
Parent 78921
Child 78920
Child 78921
  C-c C-cTraceback (most recent call last):
  File "tt.py", line 18, in <module>
    fut.result()
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 434, in result
    self._condition.wait(timeout)
  File "/usr/local/lib/python3.8/threading.py", line 302, in wait
    waiter.acquire()
KeyboardInterrupt
Exception in worker
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 78, in _worker
    work_item = work_queue.get(block=True)
KeyboardInterrupt
Exception in worker
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 78, in _worker
    work_item = work_queue.get(block=True)
KeyboardInterrupt
Exception in worker
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 78, in _worker
    work_item = work_queue.get(block=True)
KeyboardInterrupt
Exception in worker
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 78, in _worker
    work_item = work_queue.get(block=True)
KeyboardInterrupt
Done 78918 78917
Done 78921 78917
Done 78919 78917
Done 78920 78917

(I added some prints to the script. Here's the script I ran:)

import os
from concurrent.futures import ThreadPoolExecutor

def new_process(arg):
    pid = os.fork()
    if pid == 0:
        print("Child", os.getpid())
        ## os.execl("/usr/bin/true", "/usr/bin/true")
    else:
        print("Parent", pid)
        pid, status = os.waitpid(pid, 0)
        print("Done", pid, os.getpid())

executor = ThreadPoolExecutor(max_workers=4)
futures = [executor.submit(new_process, None)
           for i in range(0, 4)]
for fut in futures:
    fut.result()

When I uncomment the os.execl() line, the program runs and completes.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39763>
_______________________________________


More information about the Python-bugs-list mailing list