Backport #2677 to 0.11.x - #2690
Merged
Merged
Conversation
drive_timer() used AsyncTimer::poll() to determine whether a protocol deadline had elapsed. Under Tokio's cooperative task budget, Sleep::poll() may return Poll::Pending for an already-expired deadline once the task's budget is exhausted, which can happen when process_conn_events() drains a busy channel. As a result, handle_timeout() is not called even though the deadline has already elapsed. For QUIC, timers such as PTO, loss detection, and idle timeouts are correctness-critical and should not be deferred to a later scheduling round. Fix this by checking runtime.now() >= deadline before consulting the async timer. The clock is not subject to cooperative budgeting. The timer remains responsible only for registering a wakeup when the deadline lies in the future.
syszery
marked this pull request as ready for review
June 16, 2026 19:10
djc
approved these changes
Jun 16, 2026
Ralith
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #2677 to the 0.11.x maintenance branch.
drive_timer()previously relied onAsyncTimer::poll()to determine whether a deadline had elapsed. Under Tokio's cooperative task budget,Sleep::poll()may returnPoll::Pendingfor already-expired deadlines once the task has exhausted its cooperative budget. In that case,handle_timeout()would not be called until a later scheduling round, despite the deadline having already passed.Fix
The timer logic is changed to:
runtime.now() >= deadlinebefore polling the async timer