Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ack_delay in the first Handshake and 1RTT packet #3981

Closed
wants to merge 6 commits into from

Conversation

ianswett
Copy link
Contributor

@ianswett ianswett commented Aug 3, 2020

Clarifies that ack_delay includes anytime the packets were buffered and undecryptable, as well as allowing senders to better use those first ACKs if they choose.

Fixes #3980

Clarifies that ack_delay includes anytime the packets were buffered and undecryptable, as well as allowing senders to better use those first ACKs if they choose.
@marten-seemann
Copy link
Contributor

In #3970 we clarified that the ack_delay is only used for intentional delays introduced by an endpoint. Specifically, the time it takes to decrypt the packet and to parse the frames doesn’t count towards the ack_delay.

Counting the queuing delay for undecryptable packets seems to contract this.

@ianswett
Copy link
Contributor Author

ianswett commented Aug 3, 2020

Fair point. As I mention above, there are other ways this could be dealt with, including advice on processing buffered packets.

Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

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

I'm not sure about this at all.

This is about delays that are added by a sender due to being unable to process a packet (primarily due to a lack of the necessary keys). So why not be clearer about this and talk about buffering and allow ACK Delay to exceed max_ack_delay by the time that the sender holds packets.

Or, put another way, when processing an ACK frame, you allow subtract the time that you held the packet in a buffer from the current time in order to calculate the RTT sample. Then you absorb any costs you imposed. That means you don't need to concern yourself with the increase to ACK Delay.

As it relates to buffering, and there might be multiple buffered packets, I don't think that you can make a rule for the first packet in a packet number space.

The first ACK frame in the Handshake and ApplicationData packet number spaces
can be greatly delayed due to a lack of decryption keys at the time they're
received. For these two ACK frames, the max_ack_delay MAY be ignored if the
sender chooses. If the delayed ACK frame is the first RTT sample, ignoring
Copy link
Member

Choose a reason for hiding this comment

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

The last sentence reads as imperative, but it's more of a "Note that if the delayed"

@@ -348,14 +348,22 @@ latency at the peer or loss of previous ACK frames. Any delays beyond the
peer's max_ack_delay are therefore considered effectively part of path delay and
incorporated into the smoothed_rtt estimate.

The first ACK frame in the Handshake and ApplicationData packet number spaces
can be greatly delayed due to a lack of decryption keys at the time they're
received. For these two ACK frames, the max_ack_delay MAY be ignored if the
Copy link
Member

Choose a reason for hiding this comment

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

It's not really the first, but any packets that are buffered, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, though hopefully you're processing all buffered packets before sending an ACK.

Comment on lines 360 to 362
- MUST ignore the ACK Delay field of the ACK frame for packets sent in the
Initial and Handshake packet number space.
Initial and Handshake packet number space, except for the first ACK frame
received in Handshake.
Copy link
Member

Choose a reason for hiding this comment

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

I think that we are again talking about packets that might have been buffered, not just the first.

Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

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

My previous review forgot that there were two cases:

  1. a packet is received and buffered and then (much) later processed and (even) later acknowledged

  2. a packet containing an ACK is received and then (much) later processed

The first can be handled by reporting a large ACK Delay value. For packets sent before handshake confirmation, keeping max_ack_delay unbounded is the only sensible way to deal with this.

The second is what this attempts to address. But I don't think that it needs to.

Copy link
Contributor Author

@ianswett ianswett left a comment

Choose a reason for hiding this comment

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

I was attempting to deal with the first issue where a receiver can't process an acknowledge a buffered packet until they keys are available.

Ideally there would be at most one of these inflated RTT samples, though I don't think we make any suggestions on how buffered packets should be processed when the keys are available.

The second issue hadn't occurred to me, because I don't think we've observed it yet in production. That would only happen if the server received an ACK in 1RTT before completing the handshake. As you said, an implementation could subtract the time the packet was buffered from the RTT.

@@ -348,14 +348,22 @@ latency at the peer or loss of previous ACK frames. Any delays beyond the
peer's max_ack_delay are therefore considered effectively part of path delay and
incorporated into the smoothed_rtt estimate.

The first ACK frame in the Handshake and ApplicationData packet number spaces
can be greatly delayed due to a lack of decryption keys at the time they're
received. For these two ACK frames, the max_ack_delay MAY be ignored if the
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, though hopefully you're processing all buffered packets before sending an ACK.

@ianswett
Copy link
Contributor Author

ianswett commented Aug 4, 2020

I'm still not sure I love this PR, but hopefully the text is now clearer.

@ianswett
Copy link
Contributor Author

ianswett commented Aug 4, 2020

I want to add some text about processing all buffered packets at once when new keys are available, but I'd like to merge PR #3979 first.

Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

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

Yes, this needs updates based on the resolution of #3821, but it is generally good.

Comment on lines +358 to +360
The server can receive 1-RTT packets containing ACK frames before the decryption
keys are available. If the packet is buffered and later processed, the server
MAY reduce the measured RTT by the amount of time the packet was buffered.
Copy link
Member

Choose a reason for hiding this comment

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

It's the client that has this issue most often, which happens with 0-RTT. But I would switch this to just use 'endpoint'.

@janaiyengar
Copy link
Contributor

Necessary changes taken into #3821.

@martinthomson martinthomson deleted the ianswett-ack-delay-delayed branch September 24, 2020 06:45
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.

Processing buffered packets can cause hugely inflated RTT measurements
4 participants