Skip to content

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

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

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

Conversation

@BHUVANSH855

Copy link
Copy Markdown
Contributor

gh-153005: Use a monotonic clock for concurrent.interpreters Queue timeouts.

This is a backport of GH-154156 to 3.14.

The timeout deadline and timeout checks in concurrent.interpreters.Queue.get() and Queue.put() now use time.monotonic() instead of time.time().

The original change did not apply cleanly to 3.14, so the conflict was resolved while preserving the 3.14-specific exception handling.

Tests:

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

…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)
@BHUVANSH855 BHUVANSH855 changed the title gh-153005: Use a monotonic clock for concurrent.interpreters Queue timeouts [3.14] gh-153005: Use a monotonic clock for concurrent.interpreters Queue timeouts (GH-154156) Aug 18, 2026
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