[issue22976] multiprocessing Queue empty() is broken on Windows

Radosław Szkodziński report at bugs.python.org
Tue Dec 2 11:09:33 CET 2014


New submission from Radosław Szkodziński:

multiprocessing.Queue.empty() uses pipe polling on Windows. Unfortunately, pipe semantics on windows are different from POSIX.

The result is either:
- Hang when one process tries to get() and another checks for empty()
- Falsely returning empty() == False despite nothing being possible to get - because the other process is actually trying to read from the queue.

The attached testcase demonstrates the first case, with main process hard hanging on my Python 2.7.8 (anaconda), 32-bit on Windows 7 64-bit. Whether 1 or 2 happens depends on specific program flow.
Both can cause deadlocks in code that should be valid.

Note that get(block=False) actually works correctly.

It is possible that the problem is also present in Python 3.

----------
components: Library (Lib), Windows
files: testmp.py
messages: 231984
nosy: Radosław.Szkodziński, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: multiprocessing Queue empty() is broken on Windows
versions: Python 2.7
Added file: http://bugs.python.org/file37342/testmp.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22976>
_______________________________________


More information about the Python-bugs-list mailing list