You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm investigating an exception occurring when our system is under load and wanted to know if anyone has any idea what could cause the following? From reading the code it looks like the _innerConnection.Owner must be null but not sure what would cause that?
System.NullReferenceException:
at Microsoft.Data.SqlClient.SqlInternalTransaction.GetServerTransactionLevel (Microsoft.Data.SqlClient, Version=2.0.20168.4, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5)
at Microsoft.Data.SqlClient.SqlInternalTransaction.CheckTransactionLevelAndZombie (Microsoft.Data.SqlClient, Version=2.0.20168.4, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5)
at Microsoft.Data.SqlClient.SqlInternalTransaction.Commit (Microsoft.Data.SqlClient, Version=2.0.20168.4, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5)
at Microsoft.Data.SqlClient.SqlTransaction.Commit (Microsoft.Data.SqlClient, Version=2.0.20168.4, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5)
at YesSql.Session.CommitTransaction (YesSql.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=51cdb8c1938e4789)
at YesSql.Session+<CommitAsync>d__39.MoveNext (YesSql.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=51cdb8c1938e4789)
use of WeakReference should be converted to WeakReference<T> if possible because the generic version has a usage pattern designed to avoid this sort of problem with time of check time of use dsparity.
FYI the problem went away after we 1) increased the Min threads in ThreadPool 2) fixed Redis timeouts.. I'm not yet sure if 2) was causing the db transaction to timeout/fail which might be the cause.
Activity
sebastienros commentedon Jun 16, 2021
_innerConnection.Ownerpoints to this code:https://referencesource.microsoft.com/#System.Data/fx/src/data/System/Data/ProviderBase/DbConnectionInternal.cs,294
Which is a
WeakReferenceso I believe the getter should create a local copy ofTargetand check for nullability.https://referencesource.microsoft.com/#System.Data/fx/src/data/System/Data/ProviderBase/DbConnectionInternal.cs,39
sebastienros commentedon Jun 16, 2021
Could also show a race in the pooling logic since reports of this issue seem to relate to high load.
Wraith2 commentedon Jun 16, 2021
use of
WeakReferenceshould be converted toWeakReference<T>if possible because the generic version has a usage pattern designed to avoid this sort of problem with time of check time of use dsparity.ShaneCourtrille commentedon Jun 17, 2021
The current code also loses the original exception which from our point of view is the most important one.
ShaneCourtrille commentedon Jun 17, 2021
FYI the problem went away after we 1) increased the Min threads in ThreadPool 2) fixed Redis timeouts.. I'm not yet sure if 2) was causing the db transaction to timeout/fail which might be the cause.