[New-bugs-announce] [issue38195] A bug in the multiprocessing module

eshkrig report at bugs.python.org
Tue Sep 17 02:51:09 EDT 2019

New submission from eshkrig <eshkrig at gmail.com>:


I found a bug in the multiprocessing module.

The documentation (https://docs.python.org/3.6/library/multiprocessing.html) for the Queue.get method says:
"If timeout is a positive number, it blocks at most timeout seconds ..."

But the Queue.get method freezes if the process filling the queue terminates while reading data.

In the attachment is an example of a program (testqueue.py) that freezes after ~ 5-30 seconds.
After pressing <control>-<c>, the output is as follows:
Traceback (most recent call last):
  File "./testqueue.py", line 45, in <module>
    result = ps_queues[cpu].get(timeout=2)
  File "/usr/lib64/python3.6/multiprocessing/queues.py", line 108, in get
    res = self._recv_bytes()
  File "/usr/lib64/python3.6/multiprocessing/connection.py", line 216, in recv_bytes
    buf = self._recv_bytes(maxlength)
  File "/usr/lib64/python3.6/multiprocessing/connection.py", line 411, in _recv_bytes
    return self._recv(size)
  File "/usr/lib64/python3.6/multiprocessing/connection.py", line 379, in _recv
    chunk = read(handle, remaining)

Please fix it.

components: Extension Modules
files: testqueue.py
messages: 352613
nosy: eshkrig
priority: normal
severity: normal
status: open
title: A bug in the multiprocessing module
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48609/testqueue.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list