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

Do abortive connection shutdown in MsQuicConnection.Dispose #55493

Merged
merged 4 commits into from
Jul 15, 2021

Conversation

geoffkizer
Copy link
Contributor

Fixes #55492

Also add tests for QuicConnection.CloseAsync and QuicConnection.Dispose, and update the RunClientServer logic.

… for CloseAsync and Dispose, and remove CloseAsync from RunClientServer as it should not be necessary anymore
@ghost
Copy link

ghost commented Jul 12, 2021

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

Issue Details

Fixes #55492

Also add tests for QuicConnection.CloseAsync and QuicConnection.Dispose, and update the RunClientServer logic.

Author: geoffkizer
Assignees: -
Labels:

area-System.Net.Quic

Milestone: 6.0.0

}

[Theory]
// [InlineData(0)] // Fails with TimeoutException -- needs investigation
Copy link
Member

Choose a reason for hiding this comment

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

Isn't it because since you don't do any write, the stream start won't kick off and nothing gets actually sent over the wire?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's probably related to that. But it still seems like stream should get failed, even if it hasn't sent anything on the wire yet.

Copy link
Member

@CarnaViire CarnaViire Jul 12, 2021

Choose a reason for hiding this comment

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

This is indeed because the stream won't be created on the wire until you write at least 1 byte to it, so serverConnection.AcceptStreamAsync() never finishes - and so semaphore is never released, and so connection is not closed, and so there's no failure, just a hang.

Funny thing is if you call CloseAsync without waiting for semaphore, this would actually flush stream creation event and peer's AcceptStreamAsync would finish.

I wonder if there's a way to manually flush connection events. If not, I don't think there's much we can do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, you are right of course -- the timeout comes from the AcceptStreamAsync.

I wonder if there's a way to manually flush connection events. If not, I don't think there's much we can do.

I think that FlushAsync on a stream that hasn't been started on the wire should force it to be started on the wire.

That would simplify a few things, like the stream construction logic we use for the Stream Conformance Tests, where we currently have to send and receive a byte in order to force stream creation before using it for the tests.

But that's not something we need to tackle right now, I think. Besides, it gets in to the broader discussion about send buffering and flushing that we are punting for 6.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All that said, for now I am just going to remove these "0" variations, since they end up behaving quite differently than the others. If you think it's worthwhile to have tests for this, let's figure out how to add them later; but they are probably separate tests.

MsQuicApi.Api.ConnectionShutdownDelegate(
_state.Handle,
QUIC_CONNECTION_SHUTDOWN_FLAGS.SILENT,
0);
Copy link
Member

Choose a reason for hiding this comment

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

It feels like it should be configurable from somewhere, but we might want to at least have it as a constant DEFAULT_ABORT_CODE or something like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This value doesn't actually matter, because of the SILENT flag -- no error is sent to the peer.

In general though, I do agree we should define DEFAULT_ABORT_CODE or something like that.

Copy link
Member

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

LGTM

@ManickaP
Copy link
Member

Failure are unrelated.

@ManickaP ManickaP merged commit ce7759e into dotnet:main Jul 15, 2021
@geoffkizer geoffkizer deleted the connectiondispose branch July 19, 2021 20:54
@ghost ghost locked as resolved and limited conversation to collaborators Aug 18, 2021
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.

QuicConnection.Dispose should perform abortive shutdown
5 participants