New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_queue_feeder_donot_stop_onexc() of test_multiprocessing_spawn fails randomly on x86 Windows7 3.x #74780
Comments
http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/712/steps/test/logs/stdio ====================================================================== Traceback (most recent call last):
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\_test_multiprocessing.py", line 767, in test_queue_feeder_donot_stop_onexc
self.assertTrue(q.get(timeout=0.1))
File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\multiprocessing\queues.py", line 105, in get
raise Empty
queue.Empty |
Looks like build bot is too slow for timeout=0.1. I am guessing It should be. diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py
index dda03dd..42e9884 100644
--- a/Lib/multiprocessing/queues.py
+++ b/Lib/multiprocessing/queues.py
@@ -101,7 +101,7 @@ class Queue(object):
try:
if block:
timeout = deadline - time.time()
- if timeout < 0 or not self._poll(timeout):
+ if self._poll(timeout):
raise Empty
elif not self._poll():
raise Empty If we successfully acquired self._rlock, we should poll no matter how long acquire took. |
of course it should be diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py
index dda03dd..514f991 100644
--- a/Lib/multiprocessing/queues.py
+++ b/Lib/multiprocessing/queues.py
@@ -101,7 +101,7 @@ class Queue(object):
try:
if block:
timeout = deadline - time.time()
- if timeout < 0 or not self._poll(timeout):
+ if not self._poll(timeout):
raise Empty
elif not self._poll():
raise Empty |
I'm not sure that the buildbot took this code path, but I like your suggestion. Checking the reader in non-blocking mode is cheap. poll() with timeout < 0 works as poll(0), I checked the UNIX and Windows implementations. So I proposed your change as a PR, and credited you ;-) |
Thanks Grzegorz Grzywacz! I commited your idea of fix. Let's if it fixes the issue. It will be hard to check since it seems like the bug was random. Later, I will backport the fix to other branches. |
Let's *see* if it fixes the issue. It will be hard to check since it seems |
While this change is a nice fix, it isn't enough to make the test stable on slow buildbot: it failed again on the same buildbot, If I modify the timeout from 100 ms to 1 ms, the test also fail on Linux on my laptop. So I proposed #2148 to increase the timeout from 100 ms to 1 sec. |
I fixed multiprocessing.Queue.get(timeout) in 2.7, 3.6 and master. I close the issue. |
The Python 2.7 is to fix this failure: test_lock (test.test_multiprocessing.TestForkAwareThreadLock) ... ok
test_ignore (test.test_multiprocessing.TestIgnoreEINTR) ... ok
test test_multiprocessing failed -- Traceback (most recent call last):
File "/Users/db3l/buildarea/2.7.bolen-tiger/build/Lib/test/test_multiprocessing.py", line 674, in test_queue_feeder_donot_stop_onexc
self.assertTrue(q.get(timeout=0.1))
File "/Users/db3l/buildarea/2.7.bolen-tiger/build/Lib/multiprocessing/queues.py", line 132, in get
raise Empty
Empty
test_ignore_listener (test.test_multiprocessing.TestIgnoreEINTR) ... ok ====================================================================== Traceback (most recent call last):
File "/Users/db3l/buildarea/2.7.bolen-tiger/build/Lib/test/test_multiprocessing.py", line 674, in test_queue_feeder_donot_stop_onexc
self.assertTrue(q.get(timeout=0.1))
File "/Users/db3l/buildarea/2.7.bolen-tiger/build/Lib/multiprocessing/queues.py", line 132, in get
raise Empty
Empty |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: