Skip to content

Conversation

@wfurt
Copy link
Member

@wfurt wfurt commented Jul 27, 2021

I think the CloseAsync was there for historical reasons to properly close.
This should no longer be needed as well as it creates problem for tests with cancellation or somewhat destructive behavir.
Depending on timing and situation this may fail with "Transport close" or "User aborted" message event if both test function succeeded.
if we want to keep something in place I think we should replace this with Abort/Reset. (but relying on Dispose looks good to me)
I did few hundreds runs and I did not see any issue.

@wfurt wfurt requested review from CarnaViire and geoffkizer July 27, 2021 00:32
@wfurt wfurt self-assigned this Jul 27, 2021
@ghost
Copy link

ghost commented Jul 27, 2021

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

Issue Details

I think the CloseAsync was there for historical reasons to properly close.
This should no longer be needed as well as it creates problem for tests with cancellation or somewhat destructive behavir.
Depending on timing and situation this may fail with "Transport close" or "User aborted" message event if both test function succeeded.
if we want to keep something in place I think we should replace this with Abort/Reset. (but relying on Dispose looks good to me)
I did few hundreds runs and I did not see any issue.

Author: wfurt
Assignees: wfurt
Labels:

area-System.Net.Quic

Milestone: -

@danmoseley
Copy link
Member

@MihaZupan this test hung on net6.0-Linux-Debug-x64-mono_interpreter_release-Debian.9.Amd64.Open

   System.Net.NameResolution.Functional.Tests: [Long Running Test] 'System.Net.NameResolution.Tests.TelemetryTest.ResolutionsWaitingOnQueue_ResolutionStartCalledBeforeEnqueued', Elapsed: 00:14:11
Killed
['System.Net.NameResolution.Functional.Tests' END OF WORK ITEM LOG: Command timed out, and was killed]

Related to your #56208 ?

@MihaZupan
Copy link
Member

Yes, the test was added in that PR. I will take a look

@CarnaViire
Copy link
Member

@wfurt could you please describe a situation that this is fixing? I still don't understand how both of the functions can return, (which should mean that all streams were finished and disposed) but the connections are still not save to call Close. Isn't that a symptom of client/server functions badly written e.g. leaking streams?
As for relying on dispose - Disposing connection would also call "Close" ("shutdown" in msquic language) but with more dangerous SILENT parameter, which IMO is even worse - AFAIK it will not notify peer of connection being closed, so it may just hide bad behavior, or peer might even end up hanging forever

@wfurt
Copy link
Member Author

wfurt commented Aug 4, 2021

Here is example of failed run of ReadOutstanding_ReadAborted_Throws.

Test function calls serverStream.AbortRead(ExpectedErrorCode);

     System.Net.Quic.QuicOperationAbortedException : Operation aborted.
      Stack Trace:
        /home/furt/github/wfurt-runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs(1368,0): at System.Net.Quic.Implementations.MsQuic.MsQuicStream.HandleEventConnectionClose(State state)
        /home/furt/github/wfurt-runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs(952,0): at System.Net.Quic.Implementations.MsQuic.MsQuicStream.HandleEventShutdownComplete(State state, StreamEvent& evt)
        /home/furt/github/wfurt-runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs(808,0): at System.Net.Quic.Implementations.MsQuic.MsQuicStream.HandleEvent(State state, StreamEvent& evt)
        /home/furt/github/wfurt-runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs(770,0): at System.Net.Quic.Implementations.MsQuic.MsQuicStream.NativeCallbackHandler(IntPtr stream, IntPtr context, StreamEvent& streamEvent)
        --- End of stack trace from previous location ---
        /home/furt/github/wfurt-runtime/src/libraries/System.Net.Quic/src/System/Net/Quic/Implementations/MsQuic/MsQuicStream.cs(600,0): at System.Net.Quic.Implementations.MsQuic.MsQuicStream.ShutdownCompleted(CancellationToken cancellationToken)
        /home/furt/github/wfurt-runtime/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs(246,0): at System.Net.Quic.Tests.QuicTestBase`1.<>c__DisplayClass33_0.<<RunStreamClientServer>b__1>d.MoveNext()
        --- End of stack trace from previous location ---
        /home/furt/github/wfurt-runtime/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs(246,0): at System.Net.Quic.Tests.QuicTestBase`1.<>c__DisplayClass33_0.<<RunStreamClientServer>b__1>d.MoveNext()
        --- End of stack trace from previous location ---
        /home/furt/github/wfurt-runtime/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicTestBase.cs(164,0): at System.Net.Quic.Tests.QuicTestBase`1.<>c__DisplayClass32_1.<<RunClientServer>b__0>d.MoveNext()
        --- End of stack trace from previous location ---

We got Connection close and that will break the ShutdownCompleted. It is likely this is specific to cases when test does something abortive. I understand the concern about silent failures. However, if the test care, it should probably verify what ever behavior in the callback-functions.

Perhaps different fix would be to another parameter to simply cleanup as fast as e can in abortive way, ignoring errors, making sure we do not crash.

Or alternatively avoid RunClientServer for dispose, cancellation or abort test cases.

Any thoughts on this @ManickaP @geoffkizer ???

@ManickaP
Copy link
Member

ManickaP commented Aug 5, 2021

@wfurt: Should this be closed in favor of merged #56839?

@wfurt
Copy link
Member Author

wfurt commented Aug 5, 2021

I will wait. And see if we end up using different test pattern for the cases when the test cause damage to the provided objects.

@wfurt wfurt closed this Aug 5, 2021
@karelz karelz added this to the 6.0.0 milestone Aug 17, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 16, 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.

7 participants