-
Notifications
You must be signed in to change notification settings - Fork 96
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
Refactor Error handling to fix bugs #271
base: master
Are you sure you want to change the base?
Conversation
Connection Errors in RequestStream now also close the connection. And the tests are fixed. |
…d replacing it with Atomics or OnceLock structures for each different thing
…started but no headers sent. This is the fist step to fix this with a test. But the test is not perfect yet
@seanmonstar i noticed another Problem. The h3/h3/src/server/connection.rs Lines 110 to 143 in dbf2523
This line waits for a bidirectional stream and also drives the connection forward by listening to the control-stream and with the changes from this PR also gets notified over mpsc when a connection-error in a different request-stream occurs. h3/h3/src/server/connection.rs Line 115 in dbf2523
This lines from the h3/h3/src/server/connection.rs Lines 136 to 137 in dbf2523
When a client starts a bidirectional stream but sends no headers, the This also introduces some kind of head of line blocking, because the server cannot process any other request if the first one is slower. I see two possible solutions:
I would prefer the second option, because this is a low level crate and with this the user has more control. Also the number of maximal concurrent steams is managed by the quic layer. So no need to hold this information in h3. https://www.rfc-editor.org/rfc/rfc9114#name-streams
What do you think? |
I think it'd probably be best to tackle that in a follow-up PR. Good work! |
I can do it in a "follow-up" PR. But i probably will do the "follow-up" first because this PR will get easier with that problem fixed. |
I noticed, that I need to address this here, because I need changes already made in this PR. And to continue this PR I need this fixed. |
No problem, let me know when you think it's ready and I'll give it a review! |
I think I am almost done with this PR. I left a summary in the first comment and a list of open todos. |
…aits. But it is necessary to make h3-webtransport work with the new error types
…tions I can simply add this in a follow up PR again.
@seanmonstar I think this PR is ready for a first review. Let me know what you think. I summarized the changes in the initial PR description (see above). |
See #270
This PR implements some of the ideas from #177
Summary
Summary of the most important changes
Error Types
This PR changes how the Error handling in H3 works.
Errors can occur from 2 places:
Error from Quic Layer
Before this PR, Errors from the Quic layer came with a generic Error type, which implemented this trait:
With this PR the Error types used in the quic traits are types defined in h3.
For Connection level traits:
And for Stream level traits:
They make it easier to separate stream errors from connection errors and there are no invalid states.
Return Error types
The User facing Error Type changed from:
to
The pros of the new error types:
Server incoming Request streams
The accept method signature changed from:
to
The new Method returns a RequestResolver struct, which provides a method to resolve the request to get the Request itself and the Request stream.
Pros:
accept
returns aConnectionError
andresolve_request
returns aStreamError
Internal Error Handling
The shared state of a Connection and its Streams changed from:
to
which is stored in an
Arc
within the structs.Pros:
If an error occurs on the
RequestStream
it sets the error and wakes the Connection.The Connection which is polled always, closes the connection if needed.
Datagram traits
In order to adapt the new handling to h3-webtransport and h3-datagram a few things were cleaned up and the datagram traits where changed, to move more code to h3-datagram which was previously implemented in h3-webtransport or h3-quinn. This also allows to poll for incoming datagrams or sending while still polling the h3
Connection
Open Todos