-
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
[QUIC] Remove connection state from QuicStream #72599
Conversation
Tagging subscribers to this area: @dotnet/ncl Issue DetailsUpdate msquic to the latest which contains the details in Also revised some exception and attempted to fix them, please @rzikm check if I'm inline with your
|
a50d816
to
33fa788
Compare
Exception exception = data.ConnectionShutdownByApp != 0 && data.ConnectionClosedRemotely == 0 ? | ||
ThrowHelper.GetOperationAbortedException() : | ||
// TODO: this will contain 0 for transport shutdown, we should propagate transport error code. | ||
ThrowHelper.GetConnectionAbortedException(data.ConnectionShutdownByApp != 0 ? (long)data.ConnectionErrorCode : 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not throw with ConnectionAborted
at all if the connection was shut down by transport. In case of shutdown by transport, we should get the exception with the QuicError
corresponding to the CloseStatus
provided in the SHUTDOWN_INITIATED_BY_TRANSPORT
event on the connection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't have that ability before and we don't have it now.
We do have a transport error code, but we ignore it in both cases (SHUTDOWN_INITIATED_BY_TRANSPORT and here) because we haven't come up with solution where/how to put it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it is something we need to follow-up on, can we put there InternalError for now? I really dislike the idea of Shutdown-by-transport being surfaced as Shutdown-by-application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the liberty of assuming IdleConnection for local transport closure, which from to quick check of msquic looks like it's the most probably cause when you're at the point you already have some streams open (I might have overlooked something and it might obviously change). And I put a comment and linked the issue there. We can solve it for .NET 8.
If you think my assumption is wrong, I'll put InternalError
there as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't, mind misrepresenting actual protocol violations as idle timeout for now, then I am fine with it.
Once I am done with the task I am currently working on, I would like to take a look at the follow-up, I feel it would be better to try to squeeze it in 7.0.
-1 => GetOperationAbortedException(), // Shutdown initiated by us. | ||
long err => new QuicException(QuicError.ConnectionAborted, err, SR.Format(SR.net_quic_connectionaborted, err)) // Shutdown initiated by peer. | ||
}; | ||
return new QuicException(QuicError.ConnectionAborted, errorCode, SR.Format(SR.net_quic_connectionaborted, errorCode)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer an assert here so that we don't accidentally call this with the old "unset" value of -1, same for the other method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no -1 anymore, the code comes straight from msquic.
/azp list |
/azp run runtime-libraries-coreclr outerloop |
1 similar comment
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-libraries-coreclr outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I would like @CarnaViire to have a look as well before merging
what would happen if somebody runs with older msquic? |
It obviously won't work properly, both flags will be 0 (since they were part of But I do assume we're gonna release a new version of msquic for .NET 7.0, publish it before GA and check for that version in |
Failures are unrelated. |
I think that would be OK as far as we don't cause access violation or some other fatal error. We can be clear about what is minimal supported msquic version. |
src/libraries/System.Net.Quic/src/System/Net/Quic/QuicStream.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Update msquic to the latest which contains the details in
SHUTDOWN_COMPLETE
event so we don't have to keep the link between the object anymore.Also revised some exception and attempted to fix them, please @rzikm check if I'm inline with your
QuicException
intentions.Fixes #72238