Skip to content
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

Merged
merged 4 commits into from
Jul 26, 2022

Conversation

ManickaP
Copy link
Member

@ManickaP ManickaP commented Jul 21, 2022

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

@ghost
Copy link

ghost commented Jul 21, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

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.

Author: ManickaP
Assignees: -
Labels:

area-System.Net.Quic

Milestone: -

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);
Copy link
Member

@rzikm rzikm Jul 21, 2022

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

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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.

Copy link
Member

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));
Copy link
Member

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

Copy link
Member Author

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.

@ManickaP
Copy link
Member Author

/azp list

@ManickaP
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

1 similar comment
@ManickaP
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ManickaP
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@rzikm rzikm left a 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

@wfurt
Copy link
Member

wfurt commented Jul 24, 2022

what would happen if somebody runs with older msquic?

@ManickaP
Copy link
Member Author

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 RESERVED field and the exception will wrongly be ConnectionIdle.

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 MsQuicApi.

@ManickaP
Copy link
Member Author

Failures are unrelated.

@wfurt
Copy link
Member

wfurt commented Jul 24, 2022

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 RESERVED field and the exception will wrongly be ConnectionIdle.

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 MsQuicApi.

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.

Copy link
Member

@CarnaViire CarnaViire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@ManickaP ManickaP merged commit 39d82c9 into dotnet:main Jul 26, 2022
@ManickaP ManickaP deleted the mapichov/update-msquic branch July 26, 2022 18:07
@karelz karelz added this to the 7.0.0 milestone Aug 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure System.Net.Quic.Tests.MsQuicTests.SetListenerTimeoutWorksWithSmallTimeout
5 participants