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.

classification
Title: multiprocessing: Hang when interpreter exits after ProcessPoolExecutor.shutdown(wait=False)
Type: behavior Stage: patch review
Components: Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: bquinlan Nosy List: bquinlan
Priority: normal Keywords: patch

Created on 2020-01-03 21:26 by bquinlan, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 18221 merged bquinlan, 2020-01-27 22:25
Messages (2)
msg359257 - (view) Author: Brian Quinlan (bquinlan) * (Python committer) Date: 2020-01-03 21:26
```
from concurrent.futures import ProcessPoolExecutor
import time

t = ProcessPoolExecutor(max_workers=3)
t.map(time.sleep, [1,2,3])
t.shutdown(wait=False)
```

Results in this exception and then a hang (i.e. Python doesn't terminate):
```
Exception in thread QueueManagerThread:
Traceback (most recent call last):
  File "/usr/local/google/home/bquinlan/cpython/Lib/threading.py", line 944, in _bootstrap_inner
    self.run()
  File "/usr/local/google/home/bquinlan/cpython/Lib/threading.py", line 882, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/google/home/bquinlan/cpython/Lib/concurrent/futures/process.py", line 352, in _queue_management_worker
    _add_call_item_to_queue(pending_work_items,
  File "/usr/local/google/home/bquinlan/cpython/Lib/concurrent/futures/process.py", line 280, in _add_call_item_to_queue
    call_queue.put(_CallItem(work_id,
  File "/usr/local/google/home/bquinlan/cpython/Lib/multiprocessing/queues.py", line 82, in put
    raise ValueError(f"Queue {self!r} is closed")
ValueError: Queue <concurrent.futures.process._SafeQueue object at 0x7f371c4ae7f0> is closed
```
msg360828 - (view) Author: Brian Quinlan (bquinlan) * (Python committer) Date: 2020-01-28 00:50
New changeset 884eb89d4a5cc8e023deaa65001dfa74a436694c by Brian Quinlan in branch 'master':
bpo-39205: Tests that highlight a hang on ProcessPoolExecutor shutdown (#18221)
https://github.com/python/cpython/commit/884eb89d4a5cc8e023deaa65001dfa74a436694c
History
Date User Action Args
2022-04-11 14:59:24adminsetgithub: 83386
2020-01-28 01:40:13vstinnersettitle: Hang when interpreter exits after ProcessPoolExecutor.shutdown(wait=False) -> multiprocessing: Hang when interpreter exits after ProcessPoolExecutor.shutdown(wait=False)
2020-01-28 00:50:40bquinlansetmessages: + msg360828
2020-01-27 22:25:25bquinlansetkeywords: + patch
stage: patch review
pull_requests: + pull_request17601
2020-01-03 21:26:24bquinlancreate