-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
QUIC: Add API to allow detecting when peer aborts receive #58229
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsCurrently, the only way to detect that a peer has aborted receiving is to try to send and see if it fails. If a user is periodically sending data on the QuicStream, for example from a backend SQL query or other source, this means they will not discover the abort until they finish the query and try to write to the QuicStream. If this is expensive and/or long-running, that could be problematic. It would be better if they could discover the peer abort promptly and cancel any in-progress work. This happens specifically in ASP.NET with a "streamed response", where the request handling logic is writing to the response stream periodically. Currently, Kestrel has no way to be notified that the HTTP client has aborted the response. To address this, we should add an API like so: public Task WaitForWriteCompletionAsync(CancellationToken cancellationToken); If the peer aborts writes (or closes the connection, or there’s a connection failure), this would throw the appropriate error (QuicStreamAbortedException or QuicConnectionAbortedException, etc). The logic to implement this should be similar to the old ShutdownWriteCompleted method that got removed here: #55981. This code would detect when the write stream completed successfully. However, note that the old ShutdownWriteCompleted code does not seem to have handled the peer receive abort case. We will need to add code in HandleEventPeerRecvAborted to do this.
|
Reopening to track backport to 6.0 branch |
Currently, the only way to detect that a peer has aborted receiving is to try to send and see if it fails.
If a user is periodically sending data on the QuicStream, for example from a backend SQL query or other source, this means they will not discover the abort until they finish the query and try to write to the QuicStream. If this is expensive and/or long-running, that could be problematic. It would be better if they could discover the peer abort promptly and cancel any in-progress work.
This happens specifically in ASP.NET with a "streamed response", where the request handling logic is writing to the response stream periodically. Currently, Kestrel has no way to be notified that the HTTP client has aborted the response.
To address this, we should add an API like so:
If the peer aborts writes (or closes the connection, or there’s a connection failure), this would throw the appropriate error (QuicStreamAbortedException or QuicConnectionAbortedException, etc).
If the write stream completes successfully, this would return without exception.
The logic to implement this should be similar to the old ShutdownWriteCompleted method that got removed here: #55981. This code would detect when the write stream completed successfully.
However, note that the old ShutdownWriteCompleted code does not seem to have handled the peer receive abort case. We will need to add code in HandleEventPeerRecvAborted to do this.
The text was updated successfully, but these errors were encountered: