-
Notifications
You must be signed in to change notification settings - Fork 553
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
msquic crashes when stream closed from GC finalizer #1565
Comments
Are you running with a debug build of MsQuic? If not, I'd highly recommend all tests use it, as we have a ton of debug asserts that get turned on that will help you debug this. For instance: CXPLAT_TEL_ASSERT(!Stream->Flags.HandleClosed);
CXPLAT_TEL_ASSERT(!Stream->Flags.Freed); Those are checked in that code path to see if you're deleting again (best effort). Also, Windows dumps will be much easier to debug because we have debugger extensions we built to help in windbg. |
It looks like this is failing to lock a mutex. That mutex is on the connection. Is anything in .NET with the finalizer queue guaranteeing that all streams will be GC'd before the connection for those streams will be? This definitely seems like a connection getting closed before the stream. |
AFAIK I am.
I predominantly run Linux so catching this on Windows is not likely for me personally, but I think @CarnaViire might have encountered the same/similar problem on Win.
Nope, nothing guarantees the order of finalized objects in GC. We dispose in proper order, but if we fail in ctor, the object gets added to the finalization queue over which we don't have any control. This might be the issue here. This is a great point! I'll look into it and let you know what I've found. Thanks for now! |
Looking more into the code, this is 100% our fault. We should catch all exceptions from ctors, properly Dispose the handles in exceptional cases and suppress the finalization. Closing, not a bug in msquic. |
@ManickaP is there a corresponding issue in dotnet/runtime for this? |
Probably dotnet/runtime#52048 @geoffkizer. I'm planning take a look unless somebody else jumps in. |
In one our tests (I'm not able to determine which), sometime (in my case very rarely), the stream is being closed from GC finalizer thread and it leads to a SIGABRT.
I have the core dump which I can provide. I don't have logs though.
This might be an error in our code (.NET Core, System.Net.Quic). If you think so, could you please help me with locating the root cause?
cc: @CarnaViire @scalablecory @wfurt @geoffkizer
The text was updated successfully, but these errors were encountered: