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

Managed SNI prevent orphaned active packets being GC'ed without clear #888

Merged
merged 4 commits into from
Feb 1, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove unneeded error handling and add debug assertion to catch incor…
…rectly dropped packets
  • Loading branch information
Wraith2 committed Jan 20, 2021
commit 68f038bfa9060e36100a39113f3f8be41049dd05
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

// #define TRACE_HISTORY // this is used for advanced debugging when you need to trace the entire lifetime of a single packet, be very careful with it
// #define TRACE_HISTORY // this is used for advanced debugging when you need to trace the entire lifetime of a single packet, be very careful with it

using System;
using System.Buffers;
Expand Down Expand Up @@ -41,15 +41,15 @@ internal struct History
{
public enum Direction
{
Rent=0,
Return=1,
Rent = 0,
Return = 1,
}

public Direction Action;
public int RefCount;
public string Stack;
}

internal List<History> _history = null;

/// <summary>
Expand All @@ -62,7 +62,7 @@ public SNIPacket(SNIHandle owner,int id)
: this()
{
#if TRACE_HISTORY
_history = new List<Activity>();
_history = new List<History>();
#endif
_id = id;
_owner = owner;
Expand Down Expand Up @@ -284,6 +284,12 @@ private void ReadFromStreamAsyncContinuation(Task<int> t, object state)
}

callback(this, error ? TdsEnums.SNI_ERROR : TdsEnums.SNI_SUCCESS);
#if DEBUG
if (!IsInvalid)
{
Debug.Fail("unreleased packet will be dropped to GC");
}
#endif
}

/// <summary>
Expand Down