Skip to content

Cap the PTO count when working out the period - #1605

Merged
larseggert merged 1 commit into
mozilla:mainfrom
martinthomson:cap-pto-shift
Jan 31, 2024
Merged

larseggert merged 1 commit into
mozilla:mainfrom
martinthomson:cap-pto-shift

Conversation

@martinthomson

Copy link
Copy Markdown
Member

The previous code would overflow and produce a 0ns timeout when the PTO count got large (well over 24). This is because the fast_pto value tends to have trailing zero bits and shift values between 32-(number of zeros) and 31 (inclusive) would still shift left.

This code instead stops increasing the PTO once it hits 24. That should be enough for most cases.

Closes #1602.

The previous code would overflow and produce a 0ns timeout when the PTO
count got large (well over 24).  This is because the `fast_pto` value
tends to have trailing zero bits and shift values between 32-(number of
zeros) and 31 (inclusive) would still shift left.

This code instead stops increasing the PTO once it hits 24.  That should
be enough for most cases.

Closes mozilla#1602.
@codecov-commenter

codecov-commenter commented Jan 30, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9192b69) 87.58% compared to head (2b4769f) 87.58%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1605      +/-   ##
==========================================
- Coverage   87.58%   87.58%   -0.01%     
==========================================
  Files         118      118              
  Lines       38585    38581       -4     
==========================================
- Hits        33795    33791       -4     
  Misses       4790     4790              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@larseggert
larseggert merged commit 8b507d1 into mozilla:main Jan 31, 2024
@larseggert

Copy link
Copy Markdown
Collaborator

This change ends up not being sufficient to fix the idle_timeout_crazy_rtt test with #1603.

With the change in this PR, the PTO now doubles until it reaches 5033164.8s, which is ~8.32 weeks. The test runs with an RTT of 150 weeks and 10% loss rate, meaning it never terminates.

I think the way forward here is to make the RTT used for idle_timeout_crazy_rtt a little less crazy, so that the max. PTO is still sufficient. I'll incorporate that change into #1603 - yell if you disagree.

larseggert added a commit to larseggert/neqo that referenced this pull request Jan 31, 2024
@martinthomson

Copy link
Copy Markdown
Member Author

Nah, that seems fine. We could use u64 for this, but that would mean that Duration::checked_mul isn't an option.

@martinthomson
martinthomson deleted the cap-pto-shift branch January 31, 2024 21:47
martinthomson added a commit that referenced this pull request Jan 31, 2024
* Properly adjust CC state when PTOs fire before ACKs are received

* Fix test

* Fix test

* Fix another test

* Progress on the tests

* Fix another test

* Fix more tests

* Simplify assert_idle

* Try and fix sim. Doesn't work yet.

* Undo

* Fix

* Update neqo-transport/src/recovery.rs

Co-authored-by: Martin Thomson <mt@lowentropy.net>

* Make RTT in `idle_timeout_crazy_rtt` less crazy, so #1605 works

* Address code review comments

* Don't need to look at `tls_info`.

---------

Co-authored-by: Martin Thomson <mt@lowentropy.net>
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.

pto_period_inner can return 0ns

3 participants