Skip to content

[3.13] gh-153005: Use a monotonic clock for concurrent.interpreters Queue timeouts (GH-154156) - #156019

Open
BHUVANSH855 wants to merge 1 commit into
python:3.13from
BHUVANSH855:backport-154156-3.13
Open

[3.13] gh-153005: Use a monotonic clock for concurrent.interpreters Queue timeouts (GH-154156)#156019
BHUVANSH855 wants to merge 1 commit into
python:3.13from
BHUVANSH855:backport-154156-3.13

Conversation

@BHUVANSH855

@BHUVANSH855 BHUVANSH855 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Backport GH-154156 to Python 3.13.

concurrent.interpreters.Queue.get() and Queue.put() now use time.monotonic() for timeout deadlines and checks, avoiding incorrect waits when the system wall clock changes.

Tests:

  • ./python -m test test_interpreters.test_queues -j0

…eue timeouts (pythonGH-154156)

Queue.get() and Queue.put() computed their timeout deadline from
time.time(), the wall clock. If the system clock was stepped (NTP, a
manual change) while a call was blocked, the timeout could over- or
under-wait. queue.Queue uses time.monotonic() for the same reason.

Compute the deadline and check it against time.monotonic() instead.

(cherry picked from commit b94b9c8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants