]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #13373: multiprocessing.Queue.get() could sometimes block indefinitely
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 9 Nov 2011 23:37:09 +0000 (00:37 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 9 Nov 2011 23:37:09 +0000 (00:37 +0100)
when called with a timeout.  Patch by Arnaud Ysmal.

Lib/multiprocessing/queues.py
Misc/ACKS
Misc/NEWS

index 3280a2533d7dc2337c8b69a91c03500f95480edf..51d991245c1ae28730378b2280a3181cd0dfc287 100644 (file)
@@ -126,7 +126,11 @@ class Queue(object):
             if not self._rlock.acquire(block, timeout):
                 raise Empty
             try:
-                if not self._poll(block and (deadline-time.time()) or 0.0):
+                if block:
+                    timeout = deadline - time.time()
+                    if timeout < 0 or not self._poll(timeout):
+                        raise Empty
+                elif not self._poll():
                     raise Empty
                 res = self._recv()
                 self._sem.release()
index 6f2c2a11e44361b762af4020438c30a1a24f490e..2fe91749e00662f1f8cbfcc281397eab265fe271 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1001,6 +1001,7 @@ Bob Yodlowski
 Danny Yoo
 George Yoshida
 Masazumi Yoshikawa
+Arnaud Ysmal
 Bernard Yue
 Moshe Zadka
 Milan Zamazal
index 19e7960688925ee0cee47c7e24ec58f0fbc6c65e..24840b172e1012d55afd0d878f981a90e1cd86d1 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -73,6 +73,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #13373: multiprocessing.Queue.get() could sometimes block indefinitely
+  when called with a timeout.  Patch by Arnaud Ysmal.
+
 - Issue #13254: Fix Maildir initialization so that maildir contents
   are read correctly.