-
Notifications
You must be signed in to change notification settings - Fork 295
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
Managed SNI prevent orphaned active packets being GC'ed without clear #888
Conversation
@Wraith2 The core problem we need to solve in this case is "why" the "_sessionHandle" would go Let's say we handle |
I'm entirely happy with removing the try-catch if you prefer, the only thing that happens in them is packet cleanup and won't throw. I just put them there for caution, if they're problematic they can go. |
…rectly dropped packets
error handling removed and i added in an assert in the packet where the packet can be identified as dropping to the GC without breaking in the GC thread. As i said above this doesn't resolve any of the other problems in this area it just cleans up the packet handling, everything else is still under investigation. |
remove debug assert because it fails in Mars scenarios
I removed the debug assert because it fires for every packet in mars mode. I'm working through mars and will push any changes for that in a separate PR. |
...Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs
Show resolved
Hide resolved
...Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParserStateObjectManaged.cs
Show resolved
Hide resolved
Yes, you will. This one only fixes non-mars cases. The mars fix is much more complex and includes the demuxer state machine rewrite. I chose not to try and post it until your tracing changes were merged. |
In carefully timed situations a packet received asynchronously can be received after the session handle that owns the packet has been cleared.
This change takes a safety copy of the session handle (as other methods in this class already did) and checks to see if the handle is non-null before calling the read/write callback to pass the data on to the caller.
If the session handle is not valid the packet is directly cleared and dropped to the GC, this is safe to do as packets can easily be created if a pool has none available, it's just more efficient to re-use them
This was found using the reproduction in #659 but it does not fix that issue.
/cc @cheenamalhotra