Skip to content

congestion: saturate CUBIC window increment to avoid overflow - #2749

Merged
djc merged 1 commit into
quinn-rs:mainfrom
LesnyRumcajs:main
Jul 24, 2026
Merged

congestion: saturate CUBIC window increment to avoid overflow#2749
djc merged 1 commit into
quinn-rs:mainfrom
LesnyRumcajs:main

Conversation

@LesnyRumcajs

Copy link
Copy Markdown
Contributor

Resolves a panic:

`thread 'tokio-rt-worker' (2693719) panicked at /root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/quinn-proto-0.11.16/src/congestion/cubic.rs:149:17:
  attempt to add with overflow

Cubic::on_ack computes cubic_cwnd += cubic_inc as u64 (congestion/cubic.rs:161). w_cubic grows cubically with the time since the last congestion event, so on a long-lived connection with no loss for roughly a week, cubic_inc exceeds u64::MAX and the addition overflows; a panic in builds with overflow-checks = true, a silent wrap otherwise.

Kind of along the lines of the ones below:

// Update the increment and increase cwnd by MSS.
// Keep release builds from wrapping the retained credit.
self.state.cwnd_inc = self
.state
.cwnd_inc
.saturating_add(cubic_cwnd - self.state.window);

@Ralith

Ralith commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Hmm, we shouldn't be increasing the congestion except when sending at congestion-limited rate, which should be pretty difficult to do without packet loss when your window gets big enough for this to be a threat. Still, this change is clearly reasonable.

@LesnyRumcajs

Copy link
Copy Markdown
Contributor Author

Just for reference, this crash happened on a node running for around seven days, the entire thing running on a Digital Ocean VPS.

@djc djc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Would you be able to submit a backport to the 0.11.x branch for this?

@djc
djc added this pull request to the merge queue Jul 24, 2026
@LesnyRumcajs

Copy link
Copy Markdown
Contributor Author

Would you be able to submit a backport to the 0.11.x branch for this?

Will do!

Merged via the queue into quinn-rs:main with commit a1931ab Jul 24, 2026
19 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