[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Sam! ✨ 🍰 ✨

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread miss-islington


miss-islington  added the comment:


New changeset 9450c751cc2053b1c2e03ec92ed822a41223b142 by Miss Islington (bot) 
in branch '3.9':
bpo-45835: Fix race condition in test_queue (GH-29601)
https://github.com/python/cpython/commit/9450c751cc2053b1c2e03ec92ed822a41223b142


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 5cf05c71d13a4b4a94cc77da4214ee2f0b9c7de7 by Miss Islington (bot) 
in branch '3.10':
bpo-45835: Fix race condition in test_queue (GH-29601) (GH-29612)
https://github.com/python/cpython/commit/5cf05c71d13a4b4a94cc77da4214ee2f0b9c7de7


--
nosy: +lukasz.langa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset df3e53d86b2ad67da9ac2b5a3f56257d1f394982 by Sam Gross in branch 
'main':
bpo-45835: Fix race condition in test_queue (#29601)
https://github.com/python/cpython/commit/df3e53d86b2ad67da9ac2b5a3f56257d1f394982


--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27849
pull_request: https://github.com/python/cpython/pull/29613

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +27848
pull_request: https://github.com/python/cpython/pull/29612

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45835] Race condition in test_queue can lead to test failures

2021-11-17 Thread Sam Gross


Change by Sam Gross :


--
pull_requests: +27844
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29601

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45835] Race condition in test_queue can lead to test failures

2021-11-17 Thread Sam Gross


Change by Sam Gross :


--
keywords: +patch
Added file: https://bugs.python.org/file50447/issue45835_repro.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45835] Race condition in test_queue can lead to test failures

2021-11-17 Thread Sam Gross


New submission from Sam Gross :

The test_queue suite has a race condition that can lead to test failures in 
test_many_threads, test_many_threads_nonblock, and test_many_threads_timeout. 
Consumers are signaled to exit by a sentinel value (None). The sentinel values 
are at the end of the input list, but that doesn't mean they are necessarily 
enqueued at the end of the inter-thread queue when there are multiple "feeder" 
threads.

In particular, a feeder thread may be delayed in enqueueing a non-sentinel 
value. The other feeder threads may finish popping and enqueueing the remaining 
values including all the sentinels, leading to the delayed non-sentinel value 
arriving AFTER all the sentinels. The "consumer" threads exit before processing 
all the values leading to the assertion error in run_threads() in test_queue.py:

  self.assertTrue(q.empty())

I will attach a patch that adds a delay in feed() to make the race condition 
occur more frequently so that the issue is easier to reproduce.

--
components: Tests
messages: 406498
nosy: colesbury
priority: normal
severity: normal
status: open
title: Race condition in test_queue can lead to test failures
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com