Skip to content
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_put() of test_multiprocessing queue tests has a race condition #76271

Closed
vstinner opened this issue Nov 20, 2017 · 2 comments
Closed

test_put() of test_multiprocessing queue tests has a race condition #76271

vstinner opened this issue Nov 20, 2017 · 2 comments
Labels
3.7 (EOL) end of life tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

BPO 32090
Nosy @vstinner

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:

assignee = None
closed_at = <Date 2018-05-29.21:54:56.259>
created_at = <Date 2017-11-20.15:32:21.236>
labels = ['3.7', 'tests']
title = 'test_put() of test_multiprocessing queue tests has a race condition'
updated_at = <Date 2018-05-29.21:54:56.259>
user = 'https://github.com/vstinner'

bugs.python.org fields:

activity = <Date 2018-05-29.21:54:56.259>
actor = 'vstinner'
assignee = 'none'
closed = True
closed_date = <Date 2018-05-29.21:54:56.259>
closer = 'vstinner'
components = ['Tests']
creation = <Date 2017-11-20.15:32:21.236>
creator = 'vstinner'
dependencies = []
files = []
hgrepos = []
issue_num = 32090
keywords = []
message_count = 2.0
messages = ['306553', '318108']
nosy_count = 1.0
nosy_names = ['vstinner']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue32090'
versions = ['Python 3.7']

@vstinner
Copy link
Member Author

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)

@vstinner vstinner added 3.7 (EOL) end of life tests Tests in the Lib/test dir labels Nov 20, 2017
@vstinner vstinner changed the title test_put() test_put() of test_multiprocessing queue tests has a race condition Nov 20, 2017
@vstinner
Copy link
Member Author

I didn't see this failure recently, and I'm no longer able to reproduce the issue on Linux.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life tests Tests in the Lib/test dir
Projects
None yet
Development

No branches or pull requests

1 participant