-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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] Managed Access Violation in MsQuicStream finalizer #52048
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsRepro: [Fact]
public async Task ManagedAVE_MinimalFailingTest()
{
async Task GetStreamIdWithoutStartWorks()
{
using QuicListener listener = CreateQuicListener();
using QuicConnection clientConnection = CreateQuicConnection(listener.ListenEndPoint);
ValueTask clientTask = clientConnection.ConnectAsync();
using QuicConnection serverConnection = await listener.AcceptConnectionAsync();
await clientTask;
using QuicStream clientStream = clientConnection.OpenBidirectionalStream();
Assert.Equal(0, clientStream.StreamId);
// TODO: stream that is opened by client but left unaccepted by server may cause AccessViolationException in its Finalizer
}
await GetStreamIdWithoutStartWorks();
GC.Collect();
} For me it now fails on every run, with a stacktrace
As mentioned before in TODO comment, the stream that is being finalized is the one left inside connection's
|
Seems like we should drain the AcceptQueue on connection Dispose and Dispose those streams as well. |
This would fix the symptom, but I believe the same exception might also happen if the stream was accepted but then was forgotten and left undisposed for the finalizer. So we may want to search for the actual root cause. |
I haven't tested @wfurt fix yet, but I got the AVE twice in row now and according to the dumps the buffers are messed up:
I.e. nothing new, just confirming the problem with some more detail from the dump. |
I'm not digging into it. I'm just confirming the problem and sharing some details (they might be useful). But if you want me to dig deeper into the dump or test some fixes locally, I can do that. I'm weird and I like to play with lldb 😄. |
Repro:
For me it now fails on every run, with a stacktrace
As mentioned before in TODO comment, the stream that is being finalized is the one left inside connection's
Channel<MsQuicStream> AcceptQueue
- it was created and put there on PEER_STREAM_STARTED event, but was never claimed by calling AcceptStreamAsync. I didn't find an easy way to dispose what's inside AcceptQueue on connection's Dispose. But maybe that's not the only problem - users might easily leave QuicStreams undisposed, but it shouldn't lead to AVE.The text was updated successfully, but these errors were encountered: