Skip to content

Backport #2677 to 0.11.x - #2690

Merged
djc merged 1 commit into
quinn-rs:0.11.xfrom
syszery:backport/overdue-timers-0.11.x
Jun 17, 2026
Merged

Backport #2677 to 0.11.x#2690
djc merged 1 commit into
quinn-rs:0.11.xfrom
syszery:backport/overdue-timers-0.11.x

Conversation

@syszery

@syszery syszery commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Backport of #2677 to the 0.11.x maintenance branch.

drive_timer() previously relied on AsyncTimer::poll() to determine whether a deadline had elapsed. Under Tokio's cooperative task budget, Sleep::poll() may return Poll::Pending for 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:

  • Always check runtime.now() >= deadline before polling the async timer
  • Use the async timer only for future wakeups (waker registration)

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
syszery marked this pull request as ready for review June 16, 2026 19:10
@djc
djc added this pull request to the merge queue Jun 17, 2026
Merged via the queue into quinn-rs:0.11.x with commit c1e903b Jun 17, 2026
51 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants