-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Race condition in test_queue.test_shutdown_immediate_put_join
#116631
Labels
Comments
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Mar 12, 2024
…oin` The test case had a race condition: if `q.task_done()` was executed after `shutdown(immediate=True)`, then it would raise an exception because the immediate shutdown already emptied the queue. This happened rarely with the GIL (due to the switching interval), but frequently in the free-threaded build.
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Mar 12, 2024
CC @YvesDup |
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Mar 13, 2024
colesbury
added a commit
that referenced
this issue
Mar 13, 2024
…116670) The test case had a race condition: if `q.task_done()` was executed after `shutdown(immediate=True)`, then it would raise an exception because the immediate shutdown already emptied the queue. This happened rarely with the GIL (due to the switching interval), but frequently in the free-threaded build.
vstinner
pushed a commit
to vstinner/cpython
that referenced
this issue
Mar 20, 2024
…oin` (python#116670) The test case had a race condition: if `q.task_done()` was executed after `shutdown(immediate=True)`, then it would raise an exception because the immediate shutdown already emptied the queue. This happened rarely with the GIL (due to the switching interval), but frequently in the free-threaded build.
adorilson
pushed a commit
to adorilson/cpython
that referenced
this issue
Mar 25, 2024
…oin` (python#116670) The test case had a race condition: if `q.task_done()` was executed after `shutdown(immediate=True)`, then it would raise an exception because the immediate shutdown already emptied the queue. This happened rarely with the GIL (due to the switching interval), but frequently in the free-threaded build.
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
…oin` (python#116670) The test case had a race condition: if `q.task_done()` was executed after `shutdown(immediate=True)`, then it would raise an exception because the immediate shutdown already emptied the queue. This happened rarely with the GIL (due to the switching interval), but frequently in the free-threaded build.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a race condition in
test_shutdown_immediate_put_join
that leads toValueError: task_done() called too many times
. This happens frequently in the free-threaded build. It may also happen in the default build depending on when the GIL is released. You can reliably reproduce the issue by adding a short sleep at the start ofQueue.task_done()
.The problem is that we call
q.task_done()
in a thread concurrently withq.shutdown(immediate=True)
.cpython/Lib/test/test_queue.py
Lines 581 to 586 in 3e45030
The queue has one unfinished task. If,
q.task_done()
finishes first then everything is okay. However, if theq.shutdown(immediate=True)
happens first, it will remove the single outstanding task and theq.task_done()
will raise an exception.cc @EpicWink
Linked PRs
test_shutdown_immediate_put_join
#116670The text was updated successfully, but these errors were encountered: