-
Notifications
You must be signed in to change notification settings - Fork 10.3k
HTTP/3 RequestHeadersTimeout #30638
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
Merged
Merged
HTTP/3 RequestHeadersTimeout #30638
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JamesNK
commented
Mar 4, 2021
src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3TimeoutTests.cs
Outdated
Show resolved
Hide resolved
jkotalik
reviewed
Mar 4, 2021
6f7055c
to
7a39bf3
Compare
7a39bf3
to
6fa0432
Compare
JamesNK
commented
Apr 19, 2021
b52eac2
to
74956b3
Compare
halter73
reviewed
Apr 20, 2021
dba2133
to
32cdb30
Compare
halter73
reviewed
Apr 23, 2021
halter73
reviewed
Apr 23, 2021
halter73
approved these changes
Apr 23, 2021
halter73
reviewed
Apr 23, 2021
152e0d2
to
e35b224
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds RequestHeadersTimeout support to HTTP/3
Addresses #29702
(this PR is still rough. Creating it early to ask questions)The HTTP/3 approach doesn't useITimeoutControl
for this feature because multiple time controls would be required per connection, and checking them inTick()
would require locking the streams dictionary, foreaching over the values, and evaluating each timeout control.The approach used instead is like HTTP/2's drain stream queue. New streams are added to a concurrent queue, and each tick streams are checked to see whether they have received headers and are in a "started" state.I made RequestHeadersTimeout apply to both request streams and control streams. They each have the same attack vector: creating streams from the client and then never using them. Control streams use the same timeout to receive the control stream header.A future possible optimization is to check whether the first read of an incoming stream completes immediately, and the first HEADERS frame or control stream frame header is immediately available. If it is then the stream can skip being added to the startingStreamsQueue.V3: On connection tick, the stream dictionary is locked and iterated over to check for streams (both request streams and inbound control streams) to see if they have received a header.
I chose not to use TimeoutControl here to avoid each stream requiring its own TimeoutControl for this one thing AND the connection having a timeout control which streams also use to track data rates.
This PR starts to unify how inbound control streams and request streams are acted on. They are both put into the
streams
dictionary so the same logic is applied to streams from the client:@halter73 and I discussed the foreach in the lock, and while it isn't ideal: