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

Use the FRAME_ENCODING_ERROR for errors in frame encoding #3042

Merged
merged 5 commits into from
Nov 4, 2019

Conversation

marten-seemann
Copy link
Contributor

Fixes #3027.

@martinthomson martinthomson added -transport design An issue that affects the design of the protocol; resolution requires consensus. labels Sep 17, 2019
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.

LGTM, with maybe a note on the flow control one.

@@ -5061,7 +5060,7 @@ The first byte in the stream has an offset of 0. The largest offset delivered
on a stream - the sum of the offset and data length - cannot exceed 2^62-1, as
it is not possible to provide flow control credit for that data. Receipt of a
frame that exceeds this limit will be treated as a connection error of type
FLOW_CONTROL_ERROR.
FRAME_ENCODING_ERROR.
Copy link
Member

Choose a reason for hiding this comment

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

This creates an extra check that some implementations might not bother to implement. Treating this as a flow control error is also fine. I note that this doesn't use a MUST either...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved by requiring one of those two.

@martinthomson martinthomson changed the title use the FRAME_ENCONDING_ERROR for errors in frame encoding Use the FRAME_ENCODING_ERROR for errors in frame encoding Sep 17, 2019
frame that exceeds this limit will be treated as a connection error of type
FLOW_CONTROL_ERROR.
frame that exceeds this limit MUST be treated as a connection error of type
FRAME_ENCODING_ERROR or FLOW_CONTROL_ERROR.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be inclined towards only recommending FLOW_CONTROL_ERROR here.

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 permitting either is in line with principles. I mean, sure, this can be flow control, but if someone has code that validates frames and that code all directs into a FRAME_ENCODING_ERROR code path, that's fine. Checking that x+y>=2^62 might be redundant, but I don't want to say that that code can't run that check.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think options are helpful here, so I'd prefer the more specific error.

Copy link
Contributor

Choose a reason for hiding this comment

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

If there is a flow control limit < 2^62 then presumably you would check against that and not a theoretical max limits. Thus having two different errors would needlessly add an extra check.

Copy link
Member

@kazuho kazuho Sep 18, 2019

Choose a reason for hiding this comment

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

Note that there is a similar issue with MAX_STREAMS and STREAMS_BLOCKED. They communicate the cumulative count of streams of particular type using varint. It is possible to express numbers up to 262-1 however it is always an error to indicate a value above 260.

Section 4.5 currently states that STREAM_LIMIT_ERROR is to be used for communicating such error (for MAX_STREAMS. There is no mention of STREAMS_BLOCKED).

Copy link
Member

Choose a reason for hiding this comment

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

That was done before this proposed principle. Do you think that we should be aiming to have more specific error codes where possible here?

Copy link
Member

Choose a reason for hiding this comment

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

My point is that if we are going to permit the use of FRAME_ENCODING_ERROR when the STREAM frame exceeds the 262 boundary, then we should also permit the use of FRAME_ENCODING_ERROR for MAX_STREAMS frame carrying a count exceeding 260.

My weak preference is to not do either of the two, as we'd be losing a clear signal. IMO, this discussion is about the error code to be used when integrity check for certain frames fail. We can argue that integrity check is not part of frame decoding. Then, it would be natural to use the more specific error codes.

Copy link
Contributor

@janaiyengar janaiyengar left a comment

Choose a reason for hiding this comment

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

I agree with @ianswett that I would prefer FLOW_CONTROL_ERROR since it is a bit more specific. Otherwise looks fine to me.

@martinthomson
Copy link
Member

Editors discussed this and could do either. This is likely a nuisance topic for a meeting.

Editors' preference is for @marten-seemann to decide this. @marten-seemann, can you either back out the "or" on the flow control thing, or add an "or" to the stream limit frame descriptions?

@kazuho
Copy link
Member

kazuho commented Oct 16, 2019

FWIW, I think that the "or" needs to cover the following four frames: CRYPTO, STREAMS, MAX_STREAMS, STREAMS_BLOCKED.

@martinthomson
Copy link
Member

@marten-seemann, did you want to fix the examples listed in #3042 (comment) or shall I?

@marten-seemann
Copy link
Contributor Author

@martinthomson, @kazuho: I added text for CRYPTO, MAX_STREAMS and STREAMS_BLOCKED frames, however:

  • for CRYPTO frames, there's no flow control. It would be awkward to use a FLOW_CONTROL_ERROR here, so I opted for just using a FRAME_ENCODING_ERROR,
  • for MAX_STREAMS frames FRAME_ENCODING_ERROR is the only applicable error. We do have a STREAM_LIMIT_ERROR, but this error is described as "Too many streams opened", and MAX_STREAMS doesn't open any streams by itself.

@martinthomson martinthomson merged commit 9555e35 into quicwg:master Nov 4, 2019
@martinthomson
Copy link
Member

Those seem like reasonable conclusions to me. I'm happy taking this. Now I just need to ensure that the changelog is updated.

@marten-seemann marten-seemann deleted the frame-encoding-errors branch November 4, 2019 03:42
@kazuho
Copy link
Member

kazuho commented Nov 4, 2019

@marten-seemann

for CRYPTO frames, there's no flow control. It would be awkward to use a FLOW_CONTROL_ERROR here, so I opted for just using a FRAME_ENCODING_ERROR,

I'm not sure if I follow the logic here.

If there is no flow control, then I'd presume that exceeding 262 bytes is totally fine, and therefore that that the receiver should not be required (i.e. MUST) to send an error.

@marten-seemann
Copy link
Contributor Author

@kazuho There's no flow control in the sense that you don't advertise a window and you don't update any window.

@kazuho
Copy link
Member

kazuho commented Nov 4, 2019

@marten-seemann Are you suggesting that the CRYPTO stream has implicit limit of 262 bytes that can be transferred? I think my question is how you would justify it. My claim is that it's an unnecessary complexity.

@marten-seemann
Copy link
Contributor Author

@kazuho That's what's written in the spec. I was not happy with our decision from Tokio to not communicate a limit for the data that can be sent on a CRYPTO stream, and have peers just drop any frames sent on that stream in the future instead. But that's what the working group decided to do.

@kazuho
Copy link
Member

kazuho commented Nov 4, 2019

@marten-seemann I think you are conflating two different issues. #2524 is an issue about the amount of data buffered, while this issue is about the maximum offset of data an endpoint can ultimately represent.

Let me more practically explain why "MUST respond with a FRAME_ENCODING_ERROR" for a CRYPTO stream is a problem.

The reason we have allowed the use of FLOW_CONTROL_ERROR for STREAM frames is because that is an error that can be caught by the stream-level receive buffer (and it's logic), rather than the frame decoder.

Stating that the error code MUST be FRAME_ENCODING_ERROR for CRYPTO streams in this particular case goes against that agreement.

That logic that we used for STREAM frames can be equally applied to CRYPTO streams. The error code can either be CRYPTO_BUFFER_EXCEEDED or FLOW_CONTROL_ERROR. I don't mind either. But requiring FRAME_ENCODING_ERROR is different, because it could require the stream-level logic to respond either with a stream-level error code (CRYPTO_BUFFER_EXCEEDED or FLOW_CONTROL_ERROR) and frame-level error code (FRAME_DECODING_ERROR) based on the input. As can be seen, this requirement to distinguish between the two cases is the same as the one we argue for the STREAM frame case.

@marten-seemann
Copy link
Contributor Author

@kazuho You're right. I missed that we have a CRYPTO_BUFFER_EXCEEDED error. I'll prepare a follow-up PR later today. Unfortunately, it looks like it won't make it into -24 any more though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-transport design An issue that affects the design of the protocol; resolution requires consensus.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Codes for frame encoding errors
6 participants