classification
Title: test_put() of test_multiprocessing queue tests has a race condition
Type: Stage: resolved
Components: Tests Versions: Python 3.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords:

Created on 2017-11-20 15:32 by vstinner, last changed 2018-05-29 21:54 by vstinner. This issue is now closed.

Messages (2)
msg306553 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-11-20 15:32
The test failed on AMD64 FreeBSD 10.x Shared 3.x:

http://buildbot.python.org/all/#/builders/87/builds/200/steps/4/logs/stdio

FAIL: test_put (test.test_multiprocessing_fork.WithProcessesTestQueue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/_test_multiprocessing.py", line 809, in test_put
    self.assertEqual(queue_empty(queue), False)
AssertionError: True != False

--

I succeeded to reproduce the issue on Linux with this change:

diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index dbca2d89ed..0754ac0d52 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -804,7 +804,7 @@ class _TestQueue(BaseTestCase):
         queue.put_nowait(6)
 
         # the values may be in buffer but not yet in pipe so sleep a bit
-        time.sleep(DELTA)
+        time.sleep(0)
 
         self.assertEqual(queue_empty(queue), False)
         self.assertEqual(queue_full(queue, MAXSIZE), True)
msg318108 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-29 21:54
I didn't see this failure recently, and I'm no longer able to reproduce the issue on Linux.
History
Date User Action Args
2018-05-29 21:54:56vstinnersetstatus: open -> closed
resolution: out of date
messages: + msg318108

stage: resolved
2017-11-20 15:32:50vstinnersettitle: test_put() -> test_put() of test_multiprocessing queue tests has a race condition
2017-11-20 15:32:21vstinnercreate