-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
MsQuicStream may throw QuicOperationAbortedException when connection is closed by peer #69481
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsObserved when stressing functional tests:
It seems there is a data race that makes us throw The data race seems to come from the way MsQuic is implemented. It may be that we rely on behavior that MsQuic does not actually guarantee.
|
@nibanks Does/should MsQuic guarantee that if Edit: same goes for the |
No, I don't believe so. |
Is this something you could consider fixing? I think the only way to fix this from our side is to wait for the event (either by spinning the thread or using the async programming model). While doable, it is not going to be pretty. |
Please open an issue on MsQuic with all the details and we can take a look. |
There's also an option of sending connection's abort code alongside the ABORTED result in the stream event @nibanks |
So is the problem here that if you get an aborted error from calling StreamSend, you want to differentiate "connection aborted" and "stream aborted"? |
We mostly intended to differentiate user-side connection abort from peer-side connection abort. The check was "if there's an error code already set to the connection, then the connection must be aborted by the peer", but the race here ended up not setting the connection's error code in time. So even if we know from somewhere it's peer side abort, we don't have anywhere to get the error code from. With "connection aborted" vs "stream aborted" it is also interesting, I think we might have a bug where we believe ABORTED always means connection abort?... |
Aborted can definitely mean either Connection or Stream aborted. |
The order of the events in MsQuic is such that the connection-wide error is signaled first, so by the time stream shutdown notification arrives, we already have the connection error code. The
Yes, and we want to include the error code in the exception. We can already differentiate this (although, as @CarnaViire noted, we currently don't do that due to an oversight during implementation). It is only the race between |
Filed microsoft/msquic#2727 |
Triage: This will be solved by moving to new API design. |
Closing as covered by #69675 as we'll expose |
Observed when stressing functional tests:
It seems there is a data race that makes us throw
QuicOperationAbortedException
instead ofQuicConnectionAbortedException
. And thus indicate, that the connection was closed locally (while it was actually closed remotely with an error code).The data race seems to come from the way MsQuic is implemented. It may be that we rely on behavior that MsQuic does not actually guarantee.
Connection->State.ClosedRemotely = TRUE
, but does not indicate the event to the application yetMsQuicStreamSend
checksConnection->State.ClosedRemotely
and returnsQUIC_STATUS_ABORTED
QUIC_CONNECTION_EVENT_SHUTDOWN_INITIATED_BY_PEER
orQUIC_CONNECTION_EVENT_SHUTDOWN_INITIATED_BY_TRANSPORT
. Since none of these events were fired (yet), we interpret the status as "connection was closed locally" ->System.Net.Quic.QuicOperationAbortedException : Operation aborted.
The text was updated successfully, but these errors were encountered: