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

Connection does not support MultipleActiveResultSets error after different connection doomed #971

Closed
nickljones opened this issue Mar 8, 2021 · 40 comments

Comments

@nickljones
Copy link

nickljones commented Mar 8, 2021

Describe the bug

We are intermittently seeing a System.InvalidOperationException: The connection does not support MultipleActiveResultSets. We have turned on tracing, and whenever the exception is thrown we see the following traces running up to the exception:


2021-03-03T05:31:14.7349735Z | <sc.SNI.SNILoadHandle.LastError \|SNI\|INFO\|SETTER > Last Error Value = Microsoft.Data.SqlClient.SNI.SNIError |  
-- | -- | --
  | 2021-03-03T05:31:14.7364294Z | <sc.TdsParser.ProcessSNIError\|ERR> |  
  | 2021-03-03T05:31:14.7369261Z | < sc.TdsParser.ProcessSNIError \|ERR\|ADV > Error message Detail: |  
  | 2021-03-03T05:31:14.7375162Z | <sc.TdsParser.ProcessSNIError \|ERR\|ADV > Empty error message received from SNI. Error Message = , SNI Error Number =35 |  
  | 2021-03-03T05:31:14.7380919Z | <sc.TdsParser.ProcessSNIError \|ERR\|ADV > SNI Native Error Code = 0 |  
  | 2021-03-03T05:31:14.7402162Z | <sc.TdsParser.ProcessSNIError \|ERR\|ADV > SNI Error Message. Native Error = 0, Line Number =0, Function =, Exception =System.IO.IOException: Unable to read data from the transport connection: Connection timed out.\n ---> System.Net.Sockets.SocketException (110): Connection timed out\n --- End of inner exception stack trace ---\n at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)\n at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)\n at Microsoft.Data.SqlClient.SNI.SslOverTdsStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)\n at System.Net.Security.SslStream.<FillBufferAsync>g__InternalFillBufferAsync\|215_0[TReadAdapter](TReadAdapter adap, ValueTask`1 task, Int32 min, Int32 initial)\n at System.Net.Security.SslStream.ReadAsyncInternal[TReadAdapter](TReadAdapter adapter, Memory`1 buffer)\n at Microsoft.Data.SqlClient.SNI.SNISslStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken), Server = tcp:xxxxxxxxxxxxxx.database.windows.net,1433 |  
  | 2021-03-03T05:31:14.7402206Z | <sc.SqlError.SqlError\|ERR> infoNumber=0, errorState=0, errorClass=20, errorMessage='A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 35 - An internal exception was caught)', procedure='', lineNumber=0 |  
  | 2021-03-03T05:31:14.7402219Z | 9927486 |  
  | 2021-03-03T05:31:14.7402254Z | <sc.TdsParserStateObject.DecrementPendingCallbacks\|ADV> 306, after decrementing _pendingCallbacks: 1 |  
  | 2021-03-03T05:31:14.7409883Z | <sc.SqlCommand.EndExecuteReaderAsync\|Info\|Correlation> ObjectID474906, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1 |  
  | 2021-03-03T05:31:14.7410461Z | <prov.DbConnectionInternal.DoomThisConnection\|RES\|INFO\|CPOOL> 311, Dooming |  
  | 2021-03-03T05:31:14.7415426Z | <sc.TdsParserStateObject.DecrementPendingCallbacks\|ADV> 306, after decrementing _pendingCallbacks: 0 |  
  | 2021-03-03T05:31:14.7417989Z | <sc.SqlInternalConnectionTds.BreakConnection\|RES\|CPOOL> 311, Breaking connection. |  
  | 2021-03-03T05:31:14.7418008Z | <prov.DbConnectionInternal.DoomThisConnection\|RES\|INFO\|CPOOL> 311, Dooming |  
  | 2021-03-03T05:31:14.7418023Z | <sc.SqlConnection.Close\|API> 180782 |  
  | 2021-03-03T05:31:14.7418071Z | <sc.SqlConnection.Close\|API\|Correlation> ObjectID 180782, ActivityID f06cf9fa-72fe-4c26-b607-49740dbc6e16:1 |  
  | 2021-03-03T05:31:14.7418096Z | <prov.DbConnectionInternal.CloseConnection\|RES\|CPOOL> 311 Closing. |  
  | 2021-03-03T05:31:14.7418137Z | <prov.DbConnectionInternal.PrePush\|RES\|CPOOL> 311, Preparing to push into pool, owning connection 0, pooledCount=0 |  
  | 2021-03-03T05:31:14.7418163Z | <prov.DbConnectionPool.DeactivateObject\|RES\|CPOOL> 134, Connection 311, Deactivating. |  
  | 2021-03-03T05:31:14.7418198Z | <prov.DbConnectionInternal.DeactivateConnection\|RES\|INFO\|CPOOL> 311, Deactivating |  
  | 2021-03-03T05:31:14.7418213Z | <sc.SqlInternalConnection.Deactivate\|ADV> 311 deactivating |  
  | 2021-03-03T05:31:14.7418261Z | <prov.DbConnectionInternal.DoomThisConnection\|RES\|INFO\|CPOOL> 311, Dooming |  
  | 2021-03-03T05:31:14.7418273Z | <sc.TdsParser.Deactivate\|ADV> 306 deactivating |  
  | 2021-03-03T05:31:14.7418453Z | <sc.TdsParser.Deactivate\|STATE> 306 \n\t _physicalStateObj = False\n\t _pMarsPhysicalConObj = True\n\t _state = Broken\n\t _server = tcp:xxxxxxxxxxxxxx.database.windows.net,1433\n\t _fResetConnection = False\n\t _defaultCollation = (LCID=1033, Opts=25)\n\t _defaultCodePage = 1252\n\t _defaultLCID = 1033\n\t _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t _encryptionOption = \n\t _currentTransaction = ON\n\t _pendingTransaction = (null)\n\t _retainedTransactionId = (null)\n\t _nonTransactedOpenResultCount = 0\n\t _connHandler = 1\n\t _fMARS = 311\n\t _sessionPool = False\n\t _isYukon = (null)\n\t _sniSpnBuffer = True\n\t _errors = (null)\n\t _warnings = (null)\n\t _attentionErrors = (null)\n\t _attentionWarnings = (null)\n\t _statistics = (null)\n\t _statisticsIsInTransaction = True\n\t _fPreserveTransaction = False _fParallel = False |  
  | 2021-03-03T05:31:14.7418472Z | <prov.DbConnectionPool.DestroyObject\|RES\|CPOOL> 134, Connection 311, Removing from pool. |  
  | 2021-03-03T05:31:14.7418516Z | <prov.DbConnectionPool.DestroyObject\|RES\|CPOOL> 134, Connection 311, Removed from pool. |  
  | 2021-03-03T05:31:14.7418528Z | <sc.SqlInternalConnectionTds.Dispose\|ADV> 311 disposing |  
  | 2021-03-03T05:31:14.7418544Z | <prov.DbConnectionPool.DestroyObject\|RES\|CPOOL> 134, Connection 311, Disposed. |  
  | 2021-03-03T05:31:14.7418601Z | 9927487 |  
  | 2021-03-03T05:31:14.7419721Z | <prov.DbConnectionPool.PoolCreateRequest\|RES\|INFO\|CPOOL> 134 |  
  | 2021-03-03T05:31:14.7419740Z | <prov.DbConnectionPool.ReclaimEmancipatedObjects\|RES\|CPOOL> 134 |  
  | 2021-03-03T05:31:14.7419763Z | 462486 |  
  | 2021-03-03T05:31:14.7468382Z | <prov.DbConnectionHelper.CreateDbCommand\|API> 180782 |  
  | 2021-03-03T05:31:14.7468423Z | <sc.SqlCommand.set_Connection\|API> 474911, 180782 |  
  | 2021-03-03T05:31:14.7468431Z | 9927488 |  
  | 2021-03-03T05:31:14.7468525Z | <sc.SqlCommand.set_CommandText\|API> 474911, String Value = 'xxxxxxxxxxxxxxxxxxxxxx' |  
  | 2021-03-03T05:31:14.7468658Z | <sc.SqlConnection.OpenAsync\|API> 180782 |  
  | 2021-03-03T05:31:14.7468712Z | <sc.SqlConnection.OpenAsync\|API\|Correlation> ObjectID 180782, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1 |  
  | 2021-03-03T05:31:14.7468775Z | <prov.DbConnectionPool.GetConnection\|RES\|CPOOL> 134, Getting connection. |  
  | 2021-03-03T05:31:14.7468861Z | <prov.DbConnectionPool.GetFromGeneralPool\|RES\|CPOOL> 134, Connection 313, Popped from general pool. |  
  | 2021-03-03T05:31:14.7468978Z | <prov.DbConnectionInternal.PostPop\|RES\|CPOOL> 313, Preparing to pop from pool, owning connection 0, pooledCount=0 |  
  | 2021-03-03T05:31:14.7468991Z | <prov.DbConnectionInternal.ActivateConnection\|RES\|INFO\|CPOOL> 313, Activating |  
  | 2021-03-03T05:31:14.7469010Z | 462487 |  
  | 2021-03-03T05:31:14.7469079Z | <sc.SqlCommand.ExecuteReaderAsync\|API\|Correlation> ObjectID 474911, behavior=0, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1 |  
  | 2021-03-03T05:31:14.7469213Z | <sc.TdsParser.GetSession\|ADV> 308 getting physical session 308 |  
  | 2021-03-03T05:31:14.7469308Z | <sc.SqlCommand.ExecuteReader\|INFO> 474911, Command executed as RPC. |  
  | 2021-03-03T05:31:14.7469438Z | <sc.SNI.SNIMarsHandle.SendAsync \|SNI\|INFO\|SCOPE> |  
  | 2021-03-03T05:31:14.7469638Z | 478026 |  
  | 2021-03-03T05:31:14.7478537Z | <comm.ADP.TraceException\|ERR\|THROW> 'System.InvalidOperationException: The connection does not support MultipleActiveResultSets.' |  
  | 2021-03-03T05:31:14.7479430Z | <sc.SqlCommand.EndExecuteReaderAsync\|Info\|Correlation> ObjectID474911, ActivityID 8a720bab-d6ec-40e4-9901-0eae4f411637:1

As can be seen a connection (311) is doomed, due to the TCP connection timing out. But then it retries on a different connection (313) and throws the exception. We repeatedly see the same pattern whenever that exception is thrown.

Expected behavior

Additional tracing to be able to diagnose the problem.
The System.InvalidOperationException: The connection does not support MultipleActiveResultSets. should not be thrown.

Further technical details

Microsoft.Data.SqlClient version: 2.1.2 and 1.1.3
.NET Framework: Core 3.1
SQL Server version: Azure SQL Server
Operating system: Both Windows and Linux (docker container)

@nickljones nickljones changed the title The connection does not support MultipleActiveResultSets error after different connection doomed Connection does not support MultipleActiveResultSets error after different connection doomed Mar 8, 2021
@cheenamalhotra
Copy link
Member

@nickljones

If you have a repro for this use-case, please upload it here so we can investigate further.

@lbargery
Copy link

lbargery commented Mar 8, 2021

@nickljones

If you have a repro for this use-case, please upload it here so we can investigate further.

I also work at accuRx with Nick. Sadly we've not been able to find any rhyme or reason why or when this occurs. We've spent a long time investigating internally but are really at a dead end. There is no obvious repo, but it does reliably occurs order 10s of times a day. However, not particularly linked to busy periods and can easily go off around 11pm/midnight when our traffic is really low. Is there anything else we can try to give you here to help you investigate?

Also can tell you happens on a range of queries including ones which should take 1-2ms (selecting a row which has an index on it).

@cheenamalhotra
Copy link
Member

Is it possible to capture traces again in developer environment with a custom driver version (from nightly builds) ?
As we have additional tracing in newer builds that can be helpful to understand use-case.

You could try this feed to fetch latest build:
Microsoft.Data.SqlClient.dev

@lbargery
Copy link

lbargery commented Mar 8, 2021

@cheenamalhotra Yes, I think we see the error in our staging env and should be able to add package there with traces from Sql package.

@Wraith2
Copy link
Contributor

Wraith2 commented Mar 9, 2021

Speculation, BeginExecuteReaderInternalReadStage calls into cachedAsyncState.SetActiveConnectionAndResult (confusingly with nameof(EndExecuteReader) as a parameter which is why I think it's linked) which does:

if (!parser.MARSOn)
{
    if (activeConnection.AsyncCommandInProgress)
        throw SQL.MARSUnsupportedOnConnection();
}

Is there any previous trace information about connection 313 in the log about when it was used and returned to the pool?

@nickljones
Copy link
Author

nickljones commented Mar 9, 2021

Thanks. Here is the previous trace we have for connection 313, just over a minute before the logs above, which as far as I can tell shows a normal connection life-cycle.

2021-03-03T05:30:41.7956648Z	<prov.DbConnectionHelper.ConnectionString_Set|API> 180785, 'Data Source=tcp:xxxxxxxxxxxxxxxx.database.windows.net,1433;Initial Catalog=xxxxxxxxxxxxxxxxx;User Id=xxxxxxxxxxxxxxx@xxxxxxxxxx.database.windows.net;Max Pool Size=200;ConnectRetryCount=0;MultipleActiveResultSets=False;'	
2021-03-03T05:30:41.7956680Z	<prov.DbConnectionHelper.CreateDbCommand|API> 180785	
2021-03-03T05:30:41.7956714Z	<sc.SqlCommand.set_Connection|API> 474909, 180785	
2021-03-03T05:30:41.7956734Z	9927473	
2021-03-03T05:30:41.7956782Z	<sc.SqlCommand.set_CommandText|API> 474909, String Value = 'SELECT TOP(2) xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'	
2021-03-03T05:30:41.7956911Z	<sc.SqlConnection.OpenAsync|API> 180785	
2021-03-03T05:30:41.7957004Z	<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 180785, ActivityID f06cf9fa-72fe-4c26-b607-49740dbc6e16:1	
2021-03-03T05:30:41.7957068Z	<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection.	
2021-03-03T05:30:41.7957160Z	<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Wait timed out.	
2021-03-03T05:30:41.7959129Z	462484	
2021-03-03T05:30:41.7959458Z	<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection.	
2021-03-03T05:30:41.7959559Z	<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Creating new connection.
2021-03-03T05:30:41.7959717Z	<sc.SqlInternalConnectionTds.LoginNoFailover|ADV> 313, host=tcp:xxxxxxxxxxxxx.database.windows.net,1433	
2021-03-03T05:30:41.7959771Z	<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 308, after incrementing _pendingCallbacks: 1	
2021-03-03T05:30:41.7959811Z	<sc.SqlInternalConnectionTds.AttemptOneLogin|ADV> 313, timout=14999[msec], server=tcp:xxxxxxxxxxxxx.database.windows.net,1433	
2021-03-03T05:30:41.7959829Z	<sc.TdsParser.Connect|SEC> SQL authentication	
2021-03-03T05:30:41.8191634Z	<sc.TdsParser.Connect|SEC> Sending prelogin handshake	
2021-03-03T05:30:41.8191839Z	<sc.TdsParser.SendPreLoginHandshake|INFO> ClientConnectionID 2bab5025-ff5d-43a4-840f-fa36dadc1dd9, ActivityID 95ca93d5-004a-41d3-a080-c22ac8548082:1	
2021-03-03T05:30:41.8192301Z	<sc.TdsParser.Connect|SEC> Consuming prelogin handshake	
2021-03-03T05:30:41.8211967Z	<sc.SNI.SslOverTdsStream.Write |SNI|INFO|SCOPE> writing encapsulated bytes	
2021-03-03T05:30:41.8212302Z	478015	
2021-03-03T05:30:41.8212322Z	<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes	
2021-03-03T05:30:41.8250548Z	478016	
2021-03-03T05:30:41.8250615Z	<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes	
2021-03-03T05:30:41.8250657Z	478017	
2021-03-03T05:30:41.8250664Z	<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes	
2021-03-03T05:30:41.8250708Z	478018	
2021-03-03T05:30:41.8255462Z	<sc.SNI.SslOverTdsStream.Write |SNI|INFO|SCOPE> writing encapsulated bytes	
2021-03-03T05:30:41.8255826Z	478019	
2021-03-03T05:30:41.8255838Z	<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes	
2021-03-03T05:30:41.8278040Z	478020	
2021-03-03T05:30:41.8278126Z	<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes	
2021-03-03T05:30:41.8278148Z	478021	
2021-03-03T05:30:41.8278330Z	<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes	
2021-03-03T05:30:41.8278353Z	478022	
2021-03-03T05:30:41.8278362Z	<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes	
2021-03-03T05:30:41.8278392Z	478023	
2021-03-03T05:30:41.8614954Z	<sc.SNI.SNICommon.ValidateSslServerCertificate |SNI|SCOPE|INFO >	
2021-03-03T05:30:41.8614987Z	<sc.SNI.SNICommon.ValidateSslServerCertificate |SNI|INFO > SSL Server certificate validated.	
2021-03-03T05:30:41.8614992Z	478024	
2021-03-03T05:30:41.8615067Z	<sc.SNI.SslOverTdsStream.FinishHandshake |SNI|INFO> switched from encapsulation to passthrough mode	
2021-03-03T05:30:41.8615227Z	<sc.TdsParser.TdsLogin|ADV> 308, TDS Login7 flags = 268436448:	
2021-03-03T05:30:41.8956399Z	<sc.SqlConnection.OpenAsyncRetry|Info> 180785	
2021-03-03T05:30:41.9176149Z	<sc.TdsParser.TryRun|SEC> Received login acknowledgement token	
2021-03-03T05:30:41.9176306Z	<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for TCE	
2021-03-03T05:30:41.9176332Z	<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for GlobalTransactions	
2021-03-03T05:30:41.9176356Z	<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for DATACLASSIFICATION	
2021-03-03T05:30:41.9176374Z	<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for UTF8 support	
2021-03-03T05:30:41.9176396Z	<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for SQLDNSCACHING	
2021-03-03T05:30:41.9176576Z	<sc.SqlInternalConnectionTds.CompleteLogin|ADV> Post-Login Phase: Server connection obtained.	
2021-03-03T05:30:41.9176875Z	<sc|ActiveDirectoryAuthenticationTimeoutRetryHelper|SetState|Info>State changed from NotStarted to HasLoggedIn.	
2021-03-03T05:30:41.9176909Z	<sc.SqlInternalConnectionTds.ctor|ADV> 313, constructed new TDS internal connection	
2021-03-03T05:30:41.9176954Z	<prov.DbConnectionFactory.CreatePooledConnection|RES|CPOOL> 1, Pooled database connection created.	
2021-03-03T05:30:41.9176990Z	<prov.DbConnectionInternal.PrePush|RES|CPOOL> 313, Preparing to push into pool, owning connection 0, pooledCount=0	
2021-03-03T05:30:41.9177033Z	<prov.DbConnectionPool.CreateObject|RES|CPOOL> 134, Connection 313, Added to pool.	
2021-03-03T05:30:41.9177123Z	<prov.DbConnectionInternal.PostPop|RES|CPOOL> 313, Preparing to pop from pool, owning connection 0, pooledCount=0	
2021-03-03T05:30:41.9177147Z	<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 313, Activating	
2021-03-03T05:30:41.9177189Z	<prov.DbConnectionInternal.PrePush|RES|CPOOL> 313, Preparing to push into pool, owning connection 0, pooledCount=0	
2021-03-03T05:30:41.9177212Z	<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 134, Connection 313, Deactivating.	
2021-03-03T05:30:41.9177229Z	<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 313, Deactivating	
2021-03-03T05:30:41.9177248Z	<sc.SqlInternalConnection.Deactivate|ADV> 313 deactivating
2021-03-03T05:30:41.9177271Z	<sc.TdsParser.Deactivate|ADV> 308 deactivating	
2021-03-03T05:30:41.9177653Z	<sc.TdsParser.Deactivate|STATE> 308 \n\t _physicalStateObj = False\n\t _pMarsPhysicalConObj = True\n\t _state = OpenLoggedIn\n\t _server = tcp:accurxchainproduction.database.windows.net,1433\n\t _fResetConnection = False\n\t _defaultCollation = (LCID=1033, Opts=25)\n\t _defaultCodePage = 1252\n\t _defaultLCID = 1033\n\t _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t _encryptionOption = \n\t _currentTransaction = ON\n\t _pendingTransaction = (null)\n\t _retainedTransactionId = (null)\n\t _nonTransactedOpenResultCount = 0\n\t _connHandler = 0\n\t _fMARS = 313\n\t _sessionPool = False\n\t _isYukon = (null)\n\t _sniSpnBuffer = True\n\t _errors = (null)\n\t _warnings = (null)\n\t _attentionErrors = (null)\n\t _attentionWarnings = (null)\n\t _statistics = (null)\n\t _statisticsIsInTransaction = True\n\t _fPreserveTransaction = False _fParallel = False	
2021-03-03T05:30:41.9177684Z	<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 134, Connection 313, Pushing to general pool.	
2021-03-03T05:30:41.9951474Z	<prov.DbConnectionHelper.CreateDbCommand|API> 180785	
2021-03-03T05:30:41.9951531Z	<sc.SqlCommand.set_Connection|API> 474910, 180785	
2021-03-03T05:30:41.9951541Z	9927474	
2021-03-03T05:30:41.9951596Z	<sc.SqlCommand.set_CommandText|API> 474910, String Value = 'SELECT TOP(2) xxxxxxxxxxxxxxxxxxxxxxxxxxx'	
2021-03-03T05:30:41.9951723Z	<sc.SqlConnection.OpenAsync|API> 180785	
2021-03-03T05:30:41.9951848Z	<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 180785, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1	
2021-03-03T05:30:41.9951927Z	<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection.	
2021-03-03T05:30:41.9952026Z	<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 134, Connection 313, Popped from general pool.	
2021-03-03T05:30:41.9952164Z	<prov.DbConnectionInternal.PostPop|RES|CPOOL> 313, Preparing to pop from pool, owning connection 0, pooledCount=0	
2021-03-03T05:30:41.9952178Z	<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 313, Activating	
2021-03-03T05:30:41.9952200Z	462485	
2021-03-03T05:30:41.9952271Z	<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 474910, behavior=0, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1	
2021-03-03T05:30:41.9952421Z	<sc.TdsParser.GetSession|ADV> 308 getting physical session 308	
2021-03-03T05:30:41.9952517Z	<sc.SqlCommand.ExecuteReader|INFO> 474910, Command executed as RPC.	
2021-03-03T05:30:41.9952667Z	<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>	
2021-03-03T05:30:41.9952899Z	478025	
2021-03-03T05:30:41.9954560Z	<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 308, after incrementing _pendingCallbacks: 2	
2021-03-03T05:30:41.9983573Z	<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 308, after decrementing _pendingCallbacks: 1	
2021-03-03T05:30:41.9983840Z	<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID474910, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1	
2021-03-03T05:30:41.9984100Z	418716, 1, 0	
2021-03-03T05:30:41.9987088Z	<sc.SqlDataReader.ReadAsync|API> 1	
2021-03-03T05:30:41.9987108Z	<sc.SqlDataReader.Read|API> 1	
2021-03-03T05:30:41.9987147Z	<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> 308, NBCROW bitmap received, column count = 18	
2021-03-03T05:30:41.9987224Z	<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> NBCROW bitmap data:	
2021-03-03T05:30:41.9987238Z	9927476	
2021-03-03T05:30:41.9987457Z	9927475	
2021-03-03T05:30:41.9987527Z	<sc.SqlDataReader.ReadAsync|API> 1	
2021-03-03T05:30:41.9987541Z	<sc.SqlDataReader.Read|API> 1	
2021-03-03T05:30:41.9987554Z	9927478	
2021-03-03T05:30:41.9987561Z	9927477	
2021-03-03T05:30:41.9987586Z	<sc.SqlDataReader.NextResultAsync|API> 1	
2021-03-03T05:30:41.9987604Z	<sc.SqlDataReader.NextResult|API> 1	
2021-03-03T05:30:41.9987614Z	<sc.SqlDataReader.Read|API> 1	
2021-03-03T05:30:41.9987642Z	9927481	
2021-03-03T05:30:41.9987657Z	9927480	
2021-03-03T05:30:41.9987663Z	9927479	
2021-03-03T05:30:41.9987674Z	<sc.SqlDataReader.Close|API> 1	
2021-03-03T05:30:41.9987693Z	9927482	
2021-03-03T05:30:41.9987701Z	<sc.SqlDataReader.Close|API> 1	
2021-03-03T05:30:41.9987705Z	9927483	
2021-03-03T05:30:41.9988848Z	<sc.SqlConnection.Close|API> 180785	
2021-03-03T05:30:41.9988889Z	<sc.SqlConnection.Close|API|Correlation> ObjectID 180785, ActivityID f06cf9fa-72fe-4c26-b607-49740dbc6e16:1	
2021-03-03T05:30:41.9988910Z	<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 313 Closing.	
2021-03-03T05:30:41.9988943Z	<prov.DbConnectionInternal.PrePush|RES|CPOOL> 313, Preparing to push into pool, owning connection 0, pooledCount=0	
2021-03-03T05:30:41.9988960Z	<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 134, Connection 313, Deactivating.	
2021-03-03T05:30:41.9988973Z	<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 313, Deactivating	
2021-03-03T05:30:41.9988987Z	<sc.SqlInternalConnection.Deactivate|ADV> 313 deactivating	
2021-03-03T05:30:41.9989021Z	<sc.TdsParser.Deactivate|ADV> 308 deactivating	
2021-03-03T05:30:41.9989199Z	<sc.TdsParser.Deactivate|STATE> 308 \n\t _physicalStateObj = False\n\t _pMarsPhysicalConObj = True\n\t _state = OpenLoggedIn\n\t _server = tcp:xxxxxxxxxxxxx.database.windows.net,1433\n\t _fResetConnection = False\n\t _defaultCollation = (LCID=1033, Opts=25)\n\t _defaultCodePage = 1252\n\t _defaultLCID = 1033\n\t _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t _encryptionOption = \n\t _currentTransaction = ON\n\t _pendingTransaction = (null)\n\t _retainedTransactionId = (null)\n\t _nonTransactedOpenResultCount = 0\n\t _connHandler = 0\n\t _fMARS = 313\n\t _sessionPool = False\n\t _isYukon = (null)\n\t _sniSpnBuffer = True\n\t _errors = (null)\n\t _warnings = (null)\n\t _attentionErrors = (null)\n\t _attentionWarnings = (null)\n\t _statistics = (null)\n\t _statisticsIsInTransaction = True\n\t _fPreserveTransaction = False _fParallel = False	
2021-03-03T05:30:41.9989221Z	<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 134, Connection 313, Pushing to general pool.	
2021-03-03T05:30:41.9989283Z	9927484	
2021-03-03T05:30:41.9992923Z	<sc.SqlConnection.Close|API> 180785	
2021-03-03T05:30:41.9992959Z	<sc.SqlConnection.Close|API|Correlation> ObjectID 180785, ActivityID f06cf9fa-72fe-4c26-b607-49740dbc6e16:1	
2021-03-03T05:30:41.9992975Z	9927485	
2021-03-03T05:30:45.9176888Z	<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1

@lbargery
Copy link

@cheenamalhotra I just checked all our staging logs and the error has only gone off once in last month, so pretty unlikely we'll catch it there sadly. We'd have to use the beta package in prod but am less keen for this. That does seem to indicate it's more likely with higher traffic, could mean it's a race?

Is there anything else we can do to help pin this down? It's very disruptive for us (goes of 10s of times a day in production). We are quite high traffic consumers of Azure SQL if that helps diagnose. (I imagine 100M queries/transactions a day)

@lbargery
Copy link

Again, not sure if helpful, but we've always found the MARs exception happens after this first exception:

"A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 35 - An internal exception was caught"

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Mar 12, 2021

@lbargery

It's an interesting situation, I'm still trying to wrap my head around what's going on..
I'm interested in the timeout and SNI giving EMPTY error that Dooms connection. I need more traces to pin down what's going on exactly, specifically before timeout occurs and about object 474906.

Can you give me full trace between 2021-03-03T05:30 and 2021-03-03T05:32 ?

Also please provide exact driver version for which traces are captured, as otherwise I cannot match behaviors properly.

@lbargery
Copy link

This is the full log trace I have for this particular function invocation (happy to email to you too). The reason it takes 15 minutes is that we needed to change a setting on K8 cluster just FYI (net.ipv4.tcp_retries2). One thing I haven't worked out is why we sometimes get 400 traces, and sometimes get 11,000. Happy to share traces from other times this has gone off too.

By driver version, do you just mean nuget package version or something else?

"2021-03-03T05:15:36.7261054Z","<prov.DbConnectionHelper.ConnectionString_Set|API> 180782, 'Data Source=tcp:xxxxx.database.windows.net,1433;Initial Catalog=xxxx;User Id=USER@xxxxx.database.windows.net;Max Pool Size=200;ConnectRetryCount=0;MultipleActiveResultSets=False;'"
"2021-03-03T05:15:36.7261087Z","<prov.DbConnectionHelper.CreateDbCommand|API> 180782"
"2021-03-03T05:15:36.7261119Z","<sc.SqlCommand.set_Connection|API> 474906, 180782"
"2021-03-03T05:15:36.7261129Z",9927447
"2021-03-03T05:15:36.7261171Z","<sc.SqlCommand.set_CommandText|API> 474906, String Value = 'QUERY_TEXT'"
"2021-03-03T05:15:36.7261305Z","<sc.SqlConnection.OpenAsync|API> 180782"
"2021-03-03T05:15:36.7261402Z","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 180782, ActivityID 745531b8-8726-4d4a-83aa-4c401f81d43e:1"
"2021-03-03T05:15:36.7261470Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection."
"2021-03-03T05:15:36.7261563Z","<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 134, Connection 311, Popped from general pool."
"2021-03-03T05:15:36.7261697Z","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 311, Preparing to pop from pool,  owning connection 0, pooledCount=0"
"2021-03-03T05:15:36.7261710Z","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 311, Activating"
"2021-03-03T05:15:36.7261733Z",462477
"2021-03-03T05:15:36.7261804Z","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 474906, behavior=0, ActivityID 745531b8-8726-4d4a-83aa-4c401f81d43e:1"
"2021-03-03T05:15:36.7262009Z","<sc.TdsParser.GetSession|ADV> 306 getting physical session 306"
"2021-03-03T05:15:36.7262101Z","<sc.SqlCommand.ExecuteReader|INFO> 474906, Command executed as RPC."
"2021-03-03T05:15:36.7262227Z","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>"
"2021-03-03T05:15:36.7262474Z",478002
"2021-03-03T05:15:36.7263350Z","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 306, after incrementing _pendingCallbacks: 2"
"2021-03-03T05:15:36.8262231Z","<sc.SqlCommand.Cancel | API > 474906"
"2021-03-03T05:15:36.8262309Z","<sc.SqlCommand.Cancel|API|Correlation> ObjectID 474906, ActivityID 745531b8-8726-4d4a-83aa-4c401f81d43e:1"
"2021-03-03T05:15:36.8263127Z","<sc.TdsParser.SendAttention|INFO> Send Attention ASync."
"2021-03-03T05:15:36.8263276Z","<sc.TdsParser.WritePacket|INFO|ADV>  Packet sent"
"2021-03-03T05:15:36.8263281Z","<sc.TdsParser.SendAttention|INFO> Attention sent to the server."
"2021-03-03T05:15:36.8263291Z",9927448
"2021-03-03T05:15:45.9177632Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:15:50.3752252Z","<prov.DbConnectionHelper.ConnectionString_Set|API> 180783, 'Data Source=tcp:xxxxx.database.windows.net,1433;Initial Catalog=xxxx;User Id=USER@xxxxx.database.windows.net;Max Pool Size=200;ConnectRetryCount=0;MultipleActiveResultSets=False;'"
"2021-03-03T05:15:50.3752299Z","<prov.DbConnectionHelper.CreateDbCommand|API> 180783"
"2021-03-03T05:15:50.3752347Z","<sc.SqlCommand.set_Connection|API> 474907, 180783"
"2021-03-03T05:15:50.3752377Z",9927449
"2021-03-03T05:15:50.3752444Z","<sc.SqlCommand.set_CommandText|API> 474907, String Value = 'QUERY_TEXT'"
"2021-03-03T05:15:50.3752623Z","<sc.SqlConnection.OpenAsync|API> 180783"
"2021-03-03T05:15:50.3752689Z","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 180783, ActivityID fc76d27a-c5fb-44e3-b4de-c3f5f0f0a9af:1"
"2021-03-03T05:15:50.3752797Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection."
"2021-03-03T05:15:50.3752958Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Wait timed out."
"2021-03-03T05:15:50.3754979Z",462478
"2021-03-03T05:15:50.3755364Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection."
"2021-03-03T05:15:50.3755461Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Creating new connection."
"2021-03-03T05:15:50.3755632Z","<sc.SqlInternalConnectionTds.LoginNoFailover|ADV> 312, host=tcp:xxxxx.database.windows.net,1433"
"2021-03-03T05:15:50.3755687Z","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 307, after incrementing _pendingCallbacks: 1"
"2021-03-03T05:15:50.3755729Z","<sc.SqlInternalConnectionTds.AttemptOneLogin|ADV> 312, timout=14999[msec], server=tcp:xxxxx.database.windows.net,1433"
"2021-03-03T05:15:50.3755744Z","<sc.TdsParser.Connect|SEC> SQL authentication"
"2021-03-03T05:15:50.3926639Z","<sc.TdsParser.Connect|SEC> Sending prelogin handshake"
"2021-03-03T05:15:50.3926844Z","<sc.TdsParser.SendPreLoginHandshake|INFO> ClientConnectionID 3be14ef4-6ac9-4949-8841-8191d6556181, ActivityID 357d7e9a-bde9-4634-9b65-6906c5f45f43:1"
"2021-03-03T05:15:50.3927309Z","<sc.TdsParser.Connect|SEC> Consuming prelogin handshake"
"2021-03-03T05:15:50.3945746Z","<sc.SNI.SslOverTdsStream.Write |SNI|INFO|SCOPE> writing encapsulated bytes"
"2021-03-03T05:15:50.3945989Z",478003
"2021-03-03T05:15:50.3946005Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:15:50.3979983Z",478004
"2021-03-03T05:15:50.3980111Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:15:50.3980193Z",478005
"2021-03-03T05:15:50.3980211Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:15:50.3980314Z",478006
"2021-03-03T05:15:50.3986448Z","<sc.SNI.SslOverTdsStream.Write |SNI|INFO|SCOPE> writing encapsulated bytes"
"2021-03-03T05:15:50.3986782Z",478007
"2021-03-03T05:15:50.3986795Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:15:50.4007292Z",478008
"2021-03-03T05:15:50.4007455Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:15:50.4007511Z",478009
"2021-03-03T05:15:50.4007871Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:15:50.4007923Z",478010
"2021-03-03T05:15:50.4007946Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:15:50.4008015Z",478011
"2021-03-03T05:15:50.4017963Z","<sc.SNI.SNICommon.ValidateSslServerCertificate |SNI|SCOPE|INFO >"
"2021-03-03T05:15:50.4017994Z","<sc.SNI.SNICommon.ValidateSslServerCertificate |SNI|INFO > SSL Server certificate validated."
"2021-03-03T05:15:50.4018001Z",478012
"2021-03-03T05:15:50.4018059Z","<sc.SNI.SslOverTdsStream.FinishHandshake |SNI|INFO> switched from encapsulation to passthrough mode"
"2021-03-03T05:15:50.4018179Z","<sc.TdsParser.TdsLogin|ADV> 307, TDS Login7 flags = 268436448:"
"2021-03-03T05:15:50.4586859Z","<sc.TdsParser.TryRun|SEC> Received login acknowledgement token"
"2021-03-03T05:15:50.4587031Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 312, Received feature extension acknowledgement for TCE"
"2021-03-03T05:15:50.4587074Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 312, Received feature extension acknowledgement for GlobalTransactions"
"2021-03-03T05:15:50.4587108Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 312, Received feature extension acknowledgement for DATACLASSIFICATION"
"2021-03-03T05:15:50.4587139Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 312, Received feature extension acknowledgement for UTF8 support"
"2021-03-03T05:15:50.4587171Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 312, Received feature extension acknowledgement for SQLDNSCACHING"
"2021-03-03T05:15:50.4587442Z","<sc.SqlInternalConnectionTds.CompleteLogin|ADV> Post-Login Phase: Server connection obtained."
"2021-03-03T05:15:50.4587909Z","<sc|ActiveDirectoryAuthenticationTimeoutRetryHelper|SetState|Info>State changed from NotStarted to HasLoggedIn."
"2021-03-03T05:15:50.4587956Z","<sc.SqlInternalConnectionTds.ctor|ADV> 312, constructed new TDS internal connection"
"2021-03-03T05:15:50.4587995Z","<prov.DbConnectionFactory.CreatePooledConnection|RES|CPOOL> 1, Pooled database connection created."
"2021-03-03T05:15:50.4588045Z","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 312, Preparing to push into pool, owning connection 0, pooledCount=0"
"2021-03-03T05:15:50.4588097Z","<prov.DbConnectionPool.CreateObject|RES|CPOOL> 134, Connection 312, Added to pool."
"2021-03-03T05:15:50.4588214Z","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 312, Preparing to pop from pool,  owning connection 0, pooledCount=0"
"2021-03-03T05:15:50.4588242Z","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 312, Activating"
"2021-03-03T05:15:50.4590440Z","<sc.SqlConnection.OpenAsyncRetry|Info> 180783"
"2021-03-03T05:15:50.4591026Z","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 474907, behavior=0, ActivityID fc76d27a-c5fb-44e3-b4de-c3f5f0f0a9af:1"
"2021-03-03T05:15:50.4591293Z","<sc.TdsParser.GetSession|ADV> 307 getting physical session 307"
"2021-03-03T05:15:50.4591467Z","<sc.SqlCommand.ExecuteReader|INFO> 474907, Command executed as RPC."
"2021-03-03T05:15:50.4591666Z","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>"
"2021-03-03T05:15:50.4591774Z",478013
"2021-03-03T05:15:50.4594366Z","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 307, after incrementing _pendingCallbacks: 2"
"2021-03-03T05:15:50.4625386Z","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 307, after decrementing _pendingCallbacks: 1"
"2021-03-03T05:15:50.4625708Z","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID474907, ActivityID efc7a7c4-b375-4c79-bc37-2799b15db0e3:1"
"2021-03-03T05:15:50.4625881Z","50435980, 1, 0"
"2021-03-03T05:15:50.4628479Z","<sc.SqlDataReader.ReadAsync|API> 1"
"2021-03-03T05:15:50.4628500Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:15:50.4628536Z","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> 307, NBCROW bitmap received, column count = 18"
"2021-03-03T05:15:50.4628558Z","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> NBCROW bitmap data:"
"2021-03-03T05:15:50.4628567Z",9927451
"2021-03-03T05:15:50.4628769Z",9927450
"2021-03-03T05:15:50.4628851Z","<sc.SqlDataReader.ReadAsync|API> 1"
"2021-03-03T05:15:50.4628865Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:15:50.4628876Z",9927453
"2021-03-03T05:15:50.4628883Z",9927452
"2021-03-03T05:15:50.4628907Z","<sc.SqlDataReader.NextResultAsync|API> 1"
"2021-03-03T05:15:50.4628924Z","<sc.SqlDataReader.NextResult|API> 1"
"2021-03-03T05:15:50.4628932Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:15:50.4628936Z",9927456
"2021-03-03T05:15:50.4628950Z",9927455
"2021-03-03T05:15:50.4628956Z",9927454
"2021-03-03T05:15:50.4628983Z","<sc.SqlDataReader.Close|API> 1"
"2021-03-03T05:15:50.4629001Z",9927457
"2021-03-03T05:15:50.4629010Z","<sc.SqlDataReader.Close|API> 1"
"2021-03-03T05:15:50.4629014Z",9927458
"2021-03-03T05:15:50.4630089Z","<sc.SqlConnection.Close|API> 180783"
"2021-03-03T05:15:50.4630126Z","<sc.SqlConnection.Close|API|Correlation> ObjectID 180783, ActivityID fc76d27a-c5fb-44e3-b4de-c3f5f0f0a9af:1"
"2021-03-03T05:15:50.4630149Z","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 312 Closing."
"2021-03-03T05:15:50.4630194Z","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 312, Preparing to push into pool, owning connection 0, pooledCount=0"
"2021-03-03T05:15:50.4630214Z","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 134, Connection 312, Deactivating."
"2021-03-03T05:15:50.4630227Z","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 312, Deactivating"
"2021-03-03T05:15:50.4630241Z","<sc.SqlInternalConnection.Deactivate|ADV> 312 deactivating"
"2021-03-03T05:15:50.4630258Z","<sc.TdsParser.Deactivate|ADV> 307 deactivating"
"2021-03-03T05:15:50.4630571Z","<sc.TdsParser.Deactivate|STATE> 307 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 0\n\t         _fMARS = 312\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False"
"2021-03-03T05:15:50.4630592Z","<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 134, Connection 312, Pushing to general pool."
"2021-03-03T05:15:50.4630647Z",9927459
"2021-03-03T05:15:50.4633996Z","<sc.SqlConnection.Close|API> 180783"
"2021-03-03T05:15:50.4634042Z","<sc.SqlConnection.Close|API|Correlation> ObjectID 180783, ActivityID fc76d27a-c5fb-44e3-b4de-c3f5f0f0a9af:1"
"2021-03-03T05:15:50.4634056Z",9927460
"2021-03-03T05:15:51.0342408Z","<prov.DbConnectionHelper.ConnectionString_Set|API> 180784, 'Data Source=tcp:xxxxx.database.windows.net,1433;Initial Catalog=xxxx;User Id=USER@xxxxx.database.windows.net;Max Pool Size=200;ConnectRetryCount=0;MultipleActiveResultSets=False;'"
"2021-03-03T05:15:51.0342439Z","<prov.DbConnectionHelper.CreateDbCommand|API> 180784"
"2021-03-03T05:15:51.0342474Z","<sc.SqlCommand.set_Connection|API> 474908, 180784"
"2021-03-03T05:15:51.0342481Z",9927461
"2021-03-03T05:15:51.0342543Z","<sc.SqlCommand.set_CommandText|API> 474908, String Value = 'QUERY_TEXT'"
"2021-03-03T05:15:51.0342717Z","<sc.SqlConnection.OpenAsync|API> 180784"
"2021-03-03T05:15:51.0342774Z","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 180784, ActivityID efc7a7c4-b375-4c79-bc37-2799b15db0e3:1"
"2021-03-03T05:15:51.0342853Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection."
"2021-03-03T05:15:51.0342964Z","<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 134, Connection 312, Popped from general pool."
"2021-03-03T05:15:51.0343126Z","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 312, Preparing to pop from pool,  owning connection 0, pooledCount=0"
"2021-03-03T05:15:51.0343146Z","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 312, Activating"
"2021-03-03T05:15:51.0343175Z",462479
"2021-03-03T05:15:51.0343265Z","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 474908, behavior=0, ActivityID efc7a7c4-b375-4c79-bc37-2799b15db0e3:1"
"2021-03-03T05:15:51.0343410Z","<sc.TdsParser.GetSession|ADV> 307 getting physical session 307"
"2021-03-03T05:15:51.0343483Z","<sc.SqlCommand.ExecuteReader|INFO> 474908, Command executed as RPC."
"2021-03-03T05:15:51.0343614Z","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>"
"2021-03-03T05:15:51.0343809Z",478014
"2021-03-03T05:15:51.0344657Z","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 307, after incrementing _pendingCallbacks: 2"
"2021-03-03T05:15:51.0376113Z","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 307, after decrementing _pendingCallbacks: 1"
"2021-03-03T05:15:51.0376231Z","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID474908, ActivityID efc7a7c4-b375-4c79-bc37-2799b15db0e3:1"
"2021-03-03T05:15:51.0376547Z","60613259, 1, 0"
"2021-03-03T05:15:51.0377956Z","<sc.SqlDataReader.ReadAsync|API> 1"
"2021-03-03T05:15:51.0377973Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:15:51.0378010Z","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> 307, NBCROW bitmap received, column count = 18"
"2021-03-03T05:15:51.0378033Z","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> NBCROW bitmap data:"
"2021-03-03T05:15:51.0378040Z",9927463
"2021-03-03T05:15:51.0378212Z",9927462
"2021-03-03T05:15:51.0378294Z","<sc.SqlDataReader.ReadAsync|API> 1"
"2021-03-03T05:15:51.0378307Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:15:51.0378316Z",9927465
"2021-03-03T05:15:51.0378322Z",9927464
"2021-03-03T05:15:51.0378343Z","<sc.SqlDataReader.NextResultAsync|API> 1"
"2021-03-03T05:15:51.0378360Z","<sc.SqlDataReader.NextResult|API> 1"
"2021-03-03T05:15:51.0378381Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:15:51.0378386Z",9927468
"2021-03-03T05:15:51.0378397Z",9927467
"2021-03-03T05:15:51.0378402Z",9927466
"2021-03-03T05:15:51.0378411Z","<sc.SqlDataReader.Close|API> 1"
"2021-03-03T05:15:51.0378426Z",9927469
"2021-03-03T05:15:51.0378433Z","<sc.SqlDataReader.Close|API> 1"
"2021-03-03T05:15:51.0378435Z",9927470
"2021-03-03T05:15:51.0379867Z","<sc.SqlConnection.Close|API> 180784"
"2021-03-03T05:15:51.0379902Z","<sc.SqlConnection.Close|API|Correlation> ObjectID 180784, ActivityID fc76d27a-c5fb-44e3-b4de-c3f5f0f0a9af:1"
"2021-03-03T05:15:51.0379919Z","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 312 Closing."
"2021-03-03T05:15:51.0379945Z","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 312, Preparing to push into pool, owning connection 0, pooledCount=0"
"2021-03-03T05:15:51.0379960Z","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 134, Connection 312, Deactivating."
"2021-03-03T05:15:51.0379971Z","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 312, Deactivating"
"2021-03-03T05:15:51.0379982Z","<sc.SqlInternalConnection.Deactivate|ADV> 312 deactivating"
"2021-03-03T05:15:51.0379997Z","<sc.TdsParser.Deactivate|ADV> 307 deactivating"
"2021-03-03T05:15:51.0380404Z","<sc.TdsParser.Deactivate|STATE> 307 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 0\n\t         _fMARS = 312\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False"
"2021-03-03T05:15:51.0380445Z","<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 134, Connection 312, Pushing to general pool."
"2021-03-03T05:15:51.0380498Z",9927471
"2021-03-03T05:15:51.0383659Z","<sc.SqlConnection.Close|API> 180784"
"2021-03-03T05:15:51.0383684Z","<sc.SqlConnection.Close|API|Correlation> ObjectID 180784, ActivityID fc76d27a-c5fb-44e3-b4de-c3f5f0f0a9af:1"
"2021-03-03T05:15:51.0383697Z",9927472
"2021-03-03T05:16:15.9193889Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:16:45.9182888Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:17:15.9183522Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:17:45.9180630Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:18:15.9189510Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:18:26.1616230Z","<prov.DbConnectionPool.CleanupCallback|RES|INFO|CPOOL> 134"
"2021-03-03T05:18:26.1616371Z","<prov.DbConnectionPool.CleanupCallback|RES|INFO|CPOOL> 134, ChangeStacks=312"
"2021-03-03T05:18:26.1616709Z","<prov.DbConnectionPool.PoolCreateRequest|RES|INFO|CPOOL> 134"
"2021-03-03T05:18:26.1616727Z","<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> 134"
"2021-03-03T05:18:26.1616755Z",462480
"2021-03-03T05:18:45.9176009Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:19:15.9190857Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:19:45.9176844Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:20:15.9188059Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:20:45.9181150Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:21:15.9192058Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:21:45.9205470Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:21:46.1637960Z","<prov.DbConnectionPool.CleanupCallback|RES|INFO|CPOOL> 134"
"2021-03-03T05:21:46.1638049Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 312, Removing from pool."
"2021-03-03T05:21:46.1638105Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 312, Removed from pool."
"2021-03-03T05:21:46.1638123Z","<sc.SqlInternalConnectionTds.Dispose|ADV> 312 disposing"
"2021-03-03T05:21:46.1639854Z","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 307, after decrementing _pendingCallbacks: 0"
"2021-03-03T05:21:46.1639881Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 312, Disposed."
"2021-03-03T05:21:46.1640437Z","<prov.DbConnectionPool.PoolCreateRequest|RES|INFO|CPOOL> 134"
"2021-03-03T05:21:46.1640465Z","<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> 134"
"2021-03-03T05:21:46.1640496Z",462481
"2021-03-03T05:22:15.9185224Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:22:45.9185808Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:23:15.9189765Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:23:45.9178690Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:24:15.9186458Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:24:45.9182545Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:25:06.1628704Z","<prov.DbConnectionPool.CleanupCallback|RES|INFO|CPOOL> 134"
"2021-03-03T05:25:06.1629425Z","<prov.DbConnectionPool.PoolCreateRequest|RES|INFO|CPOOL> 134"
"2021-03-03T05:25:06.1629460Z","<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> 134"
"2021-03-03T05:25:06.1629506Z",462482
"2021-03-03T05:25:15.9186711Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:25:45.9180429Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:26:15.9191829Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:26:45.9183417Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:27:15.9193595Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:27:45.9183183Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:28:15.9187614Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:28:26.1618389Z","<prov.DbConnectionPool.CleanupCallback|RES|INFO|CPOOL> 134"
"2021-03-03T05:28:26.1618927Z","<prov.DbConnectionPool.PoolCreateRequest|RES|INFO|CPOOL> 134"
"2021-03-03T05:28:26.1619220Z","<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> 134"
"2021-03-03T05:28:26.1619261Z",462483
"2021-03-03T05:28:45.9179959Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:29:15.9189774Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:29:45.9186540Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:30:15.9189091Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:30:41.7956648Z","<prov.DbConnectionHelper.ConnectionString_Set|API> 180785, 'Data Source=tcp:xxxxx.database.windows.net,1433;Initial Catalog=xxxx;User Id=USER@xxxxx.database.windows.net;Max Pool Size=200;ConnectRetryCount=0;MultipleActiveResultSets=False;'"
"2021-03-03T05:30:41.7956680Z","<prov.DbConnectionHelper.CreateDbCommand|API> 180785"
"2021-03-03T05:30:41.7956714Z","<sc.SqlCommand.set_Connection|API> 474909, 180785"
"2021-03-03T05:30:41.7956734Z",9927473
"2021-03-03T05:30:41.7956782Z","<sc.SqlCommand.set_CommandText|API> 474909, String Value = 'QUERY_TEXT'"
"2021-03-03T05:30:41.7956911Z","<sc.SqlConnection.OpenAsync|API> 180785"
"2021-03-03T05:30:41.7957004Z","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 180785, ActivityID f06cf9fa-72fe-4c26-b607-49740dbc6e16:1"
"2021-03-03T05:30:41.7957068Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection."
"2021-03-03T05:30:41.7957160Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Wait timed out."
"2021-03-03T05:30:41.7959129Z",462484
"2021-03-03T05:30:41.7959458Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection."
"2021-03-03T05:30:41.7959559Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Creating new connection."
"2021-03-03T05:30:41.7959717Z","<sc.SqlInternalConnectionTds.LoginNoFailover|ADV> 313, host=tcp:xxxxx.database.windows.net,1433"
"2021-03-03T05:30:41.7959771Z","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 308, after incrementing _pendingCallbacks: 1"
"2021-03-03T05:30:41.7959811Z","<sc.SqlInternalConnectionTds.AttemptOneLogin|ADV> 313, timout=14999[msec], server=tcp:xxxxx.database.windows.net,1433"
"2021-03-03T05:30:41.7959829Z","<sc.TdsParser.Connect|SEC> SQL authentication"
"2021-03-03T05:30:41.8191634Z","<sc.TdsParser.Connect|SEC> Sending prelogin handshake"
"2021-03-03T05:30:41.8191839Z","<sc.TdsParser.SendPreLoginHandshake|INFO> ClientConnectionID 2bab5025-ff5d-43a4-840f-fa36dadc1dd9, ActivityID 95ca93d5-004a-41d3-a080-c22ac8548082:1"
"2021-03-03T05:30:41.8192301Z","<sc.TdsParser.Connect|SEC> Consuming prelogin handshake"
"2021-03-03T05:30:41.8211967Z","<sc.SNI.SslOverTdsStream.Write |SNI|INFO|SCOPE> writing encapsulated bytes"
"2021-03-03T05:30:41.8212302Z",478015
"2021-03-03T05:30:41.8212322Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:30:41.8250548Z",478016
"2021-03-03T05:30:41.8250615Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:30:41.8250657Z",478017
"2021-03-03T05:30:41.8250664Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:30:41.8250708Z",478018
"2021-03-03T05:30:41.8255462Z","<sc.SNI.SslOverTdsStream.Write |SNI|INFO|SCOPE> writing encapsulated bytes"
"2021-03-03T05:30:41.8255826Z",478019
"2021-03-03T05:30:41.8255838Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:30:41.8278040Z",478020
"2021-03-03T05:30:41.8278126Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:30:41.8278148Z",478021
"2021-03-03T05:30:41.8278330Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:30:41.8278353Z",478022
"2021-03-03T05:30:41.8278362Z","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes"
"2021-03-03T05:30:41.8278392Z",478023
"2021-03-03T05:30:41.8614954Z","<sc.SNI.SNICommon.ValidateSslServerCertificate |SNI|SCOPE|INFO >"
"2021-03-03T05:30:41.8614987Z","<sc.SNI.SNICommon.ValidateSslServerCertificate |SNI|INFO > SSL Server certificate validated."
"2021-03-03T05:30:41.8614992Z",478024
"2021-03-03T05:30:41.8615067Z","<sc.SNI.SslOverTdsStream.FinishHandshake |SNI|INFO> switched from encapsulation to passthrough mode"
"2021-03-03T05:30:41.8615227Z","<sc.TdsParser.TdsLogin|ADV> 308, TDS Login7 flags = 268436448:"
"2021-03-03T05:30:41.8956399Z","<sc.SqlConnection.OpenAsyncRetry|Info> 180785"
"2021-03-03T05:30:41.9176149Z","<sc.TdsParser.TryRun|SEC> Received login acknowledgement token"
"2021-03-03T05:30:41.9176306Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for TCE"
"2021-03-03T05:30:41.9176332Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for GlobalTransactions"
"2021-03-03T05:30:41.9176356Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for DATACLASSIFICATION"
"2021-03-03T05:30:41.9176374Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for UTF8 support"
"2021-03-03T05:30:41.9176396Z","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 313, Received feature extension acknowledgement for SQLDNSCACHING"
"2021-03-03T05:30:41.9176576Z","<sc.SqlInternalConnectionTds.CompleteLogin|ADV> Post-Login Phase: Server connection obtained."
"2021-03-03T05:30:41.9176875Z","<sc|ActiveDirectoryAuthenticationTimeoutRetryHelper|SetState|Info>State changed from NotStarted to HasLoggedIn."
"2021-03-03T05:30:41.9176909Z","<sc.SqlInternalConnectionTds.ctor|ADV> 313, constructed new TDS internal connection"
"2021-03-03T05:30:41.9176954Z","<prov.DbConnectionFactory.CreatePooledConnection|RES|CPOOL> 1, Pooled database connection created."
"2021-03-03T05:30:41.9176990Z","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 313, Preparing to push into pool, owning connection 0, pooledCount=0"
"2021-03-03T05:30:41.9177033Z","<prov.DbConnectionPool.CreateObject|RES|CPOOL> 134, Connection 313, Added to pool."
"2021-03-03T05:30:41.9177123Z","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 313, Preparing to pop from pool,  owning connection 0, pooledCount=0"
"2021-03-03T05:30:41.9177147Z","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 313, Activating"
"2021-03-03T05:30:41.9177189Z","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 313, Preparing to push into pool, owning connection 0, pooledCount=0"
"2021-03-03T05:30:41.9177212Z","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 134, Connection 313, Deactivating."
"2021-03-03T05:30:41.9177229Z","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 313, Deactivating"
"2021-03-03T05:30:41.9177248Z","<sc.SqlInternalConnection.Deactivate|ADV> 313 deactivating"
"2021-03-03T05:30:41.9177271Z","<sc.TdsParser.Deactivate|ADV> 308 deactivating"
"2021-03-03T05:30:41.9177653Z","<sc.TdsParser.Deactivate|STATE> 308 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 0\n\t         _fMARS = 313\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False"
"2021-03-03T05:30:41.9177684Z","<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 134, Connection 313, Pushing to general pool."
"2021-03-03T05:30:41.9951474Z","<prov.DbConnectionHelper.CreateDbCommand|API> 180785"
"2021-03-03T05:30:41.9951531Z","<sc.SqlCommand.set_Connection|API> 474910, 180785"
"2021-03-03T05:30:41.9951541Z",9927474
"2021-03-03T05:30:41.9951596Z","<sc.SqlCommand.set_CommandText|API> 474910, String Value = 'QUERY_TEXT'"
"2021-03-03T05:30:41.9951723Z","<sc.SqlConnection.OpenAsync|API> 180785"
"2021-03-03T05:30:41.9951848Z","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 180785, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1"
"2021-03-03T05:30:41.9951927Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection."
"2021-03-03T05:30:41.9952026Z","<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 134, Connection 313, Popped from general pool."
"2021-03-03T05:30:41.9952164Z","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 313, Preparing to pop from pool,  owning connection 0, pooledCount=0"
"2021-03-03T05:30:41.9952178Z","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 313, Activating"
"2021-03-03T05:30:41.9952200Z",462485
"2021-03-03T05:30:41.9952271Z","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 474910, behavior=0, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1"
"2021-03-03T05:30:41.9952421Z","<sc.TdsParser.GetSession|ADV> 308 getting physical session 308"
"2021-03-03T05:30:41.9952517Z","<sc.SqlCommand.ExecuteReader|INFO> 474910, Command executed as RPC."
"2021-03-03T05:30:41.9952667Z","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>"
"2021-03-03T05:30:41.9952899Z",478025
"2021-03-03T05:30:41.9954560Z","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 308, after incrementing _pendingCallbacks: 2"
"2021-03-03T05:30:41.9983573Z","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 308, after decrementing _pendingCallbacks: 1"
"2021-03-03T05:30:41.9983840Z","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID474910, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1"
"2021-03-03T05:30:41.9984100Z","418716, 1, 0"
"2021-03-03T05:30:41.9987088Z","<sc.SqlDataReader.ReadAsync|API> 1"
"2021-03-03T05:30:41.9987108Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:30:41.9987147Z","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> 308, NBCROW bitmap received, column count = 18"
"2021-03-03T05:30:41.9987224Z","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> NBCROW bitmap data:"
"2021-03-03T05:30:41.9987238Z",9927476
"2021-03-03T05:30:41.9987457Z",9927475
"2021-03-03T05:30:41.9987527Z","<sc.SqlDataReader.ReadAsync|API> 1"
"2021-03-03T05:30:41.9987541Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:30:41.9987554Z",9927478
"2021-03-03T05:30:41.9987561Z",9927477
"2021-03-03T05:30:41.9987586Z","<sc.SqlDataReader.NextResultAsync|API> 1"
"2021-03-03T05:30:41.9987604Z","<sc.SqlDataReader.NextResult|API> 1"
"2021-03-03T05:30:41.9987614Z","<sc.SqlDataReader.Read|API> 1"
"2021-03-03T05:30:41.9987642Z",9927481
"2021-03-03T05:30:41.9987657Z",9927480
"2021-03-03T05:30:41.9987663Z",9927479
"2021-03-03T05:30:41.9987674Z","<sc.SqlDataReader.Close|API> 1"
"2021-03-03T05:30:41.9987693Z",9927482
"2021-03-03T05:30:41.9987701Z","<sc.SqlDataReader.Close|API> 1"
"2021-03-03T05:30:41.9987705Z",9927483
"2021-03-03T05:30:41.9988848Z","<sc.SqlConnection.Close|API> 180785"
"2021-03-03T05:30:41.9988889Z","<sc.SqlConnection.Close|API|Correlation> ObjectID 180785, ActivityID f06cf9fa-72fe-4c26-b607-49740dbc6e16:1"
"2021-03-03T05:30:41.9988910Z","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 313 Closing."
"2021-03-03T05:30:41.9988943Z","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 313, Preparing to push into pool, owning connection 0, pooledCount=0"
"2021-03-03T05:30:41.9988960Z","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 134, Connection 313, Deactivating."
"2021-03-03T05:30:41.9988973Z","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 313, Deactivating"
"2021-03-03T05:30:41.9988987Z","<sc.SqlInternalConnection.Deactivate|ADV> 313 deactivating"
"2021-03-03T05:30:41.9989021Z","<sc.TdsParser.Deactivate|ADV> 308 deactivating"
"2021-03-03T05:30:41.9989199Z","<sc.TdsParser.Deactivate|STATE> 308 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 0\n\t         _fMARS = 313\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False"
"2021-03-03T05:30:41.9989221Z","<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 134, Connection 313, Pushing to general pool."
"2021-03-03T05:30:41.9989283Z",9927484
"2021-03-03T05:30:41.9992923Z","<sc.SqlConnection.Close|API> 180785"
"2021-03-03T05:30:41.9992959Z","<sc.SqlConnection.Close|API|Correlation> ObjectID 180785, ActivityID f06cf9fa-72fe-4c26-b607-49740dbc6e16:1"
"2021-03-03T05:30:41.9992975Z",9927485
"2021-03-03T05:30:45.9176888Z","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1"
"2021-03-03T05:31:14.7349735Z","<sc.SNI.SNILoadHandle.LastError |SNI|INFO|SETTER > Last Error Value = Microsoft.Data.SqlClient.SNI.SNIError"
"2021-03-03T05:31:14.7364294Z","<sc.TdsParser.ProcessSNIError|ERR>"
"2021-03-03T05:31:14.7369261Z","< sc.TdsParser.ProcessSNIError |ERR|ADV > Error message Detail:"
"2021-03-03T05:31:14.7375162Z","<sc.TdsParser.ProcessSNIError |ERR|ADV > Empty error message received from SNI. Error Message = , SNI Error Number =35"
"2021-03-03T05:31:14.7380919Z","<sc.TdsParser.ProcessSNIError |ERR|ADV > SNI Native Error Code = 0"
"2021-03-03T05:31:14.7402162Z","<sc.TdsParser.ProcessSNIError |ERR|ADV > SNI Error Message. Native Error = 0, Line Number =0, Function =, Exception =System.IO.IOException: Unable to read data from the transport connection: Connection timed out.\n ---> System.Net.Sockets.SocketException (110): Connection timed out\n   --- End of inner exception stack trace ---\n   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)\n   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)\n   at Microsoft.Data.SqlClient.SNI.SslOverTdsStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)\n   at System.Net.Security.SslStream.<FillBufferAsync>g__InternalFillBufferAsync|215_0[TReadAdapter](TReadAdapter adap, ValueTask`1 task, Int32 min, Int32 initial)\n   at System.Net.Security.SslStream.ReadAsyncInternal[TReadAdapter](TReadAdapter adapter, Memory`1 buffer)\n   at Microsoft.Data.SqlClient.SNI.SNISslStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken), Server = tcp:xxxxx.database.windows.net,1433"
"2021-03-03T05:31:14.7402206Z","<sc.SqlError.SqlError|ERR> infoNumber=0, errorState=0, errorClass=20, errorMessage='A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 35 - An internal exception was caught)', procedure='', lineNumber=0"
"2021-03-03T05:31:14.7402219Z",9927486
"2021-03-03T05:31:14.7402254Z","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 306, after decrementing _pendingCallbacks: 1"
"2021-03-03T05:31:14.7409883Z","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID474906, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1"
"2021-03-03T05:31:14.7410461Z","<prov.DbConnectionInternal.DoomThisConnection|RES|INFO|CPOOL> 311, Dooming"
"2021-03-03T05:31:14.7415426Z","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 306, after decrementing _pendingCallbacks: 0"
"2021-03-03T05:31:14.7417989Z","<sc.SqlInternalConnectionTds.BreakConnection|RES|CPOOL> 311, Breaking connection."
"2021-03-03T05:31:14.7418008Z","<prov.DbConnectionInternal.DoomThisConnection|RES|INFO|CPOOL> 311, Dooming"
"2021-03-03T05:31:14.7418023Z","<sc.SqlConnection.Close|API> 180782"
"2021-03-03T05:31:14.7418071Z","<sc.SqlConnection.Close|API|Correlation> ObjectID 180782, ActivityID f06cf9fa-72fe-4c26-b607-49740dbc6e16:1"
"2021-03-03T05:31:14.7418096Z","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 311 Closing."
"2021-03-03T05:31:14.7418137Z","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 311, Preparing to push into pool, owning connection 0, pooledCount=0"
"2021-03-03T05:31:14.7418163Z","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 134, Connection 311, Deactivating."
"2021-03-03T05:31:14.7418198Z","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 311, Deactivating"
"2021-03-03T05:31:14.7418213Z","<sc.SqlInternalConnection.Deactivate|ADV> 311 deactivating"
"2021-03-03T05:31:14.7418261Z","<prov.DbConnectionInternal.DoomThisConnection|RES|INFO|CPOOL> 311, Dooming"
"2021-03-03T05:31:14.7418273Z","<sc.TdsParser.Deactivate|ADV> 306 deactivating"
"2021-03-03T05:31:14.7418453Z","<sc.TdsParser.Deactivate|STATE> 306 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = Broken\n\t         _server = tcp:xxxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 1\n\t         _fMARS = 311\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False"
"2021-03-03T05:31:14.7418472Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 311, Removing from pool."
"2021-03-03T05:31:14.7418516Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 311, Removed from pool."
"2021-03-03T05:31:14.7418528Z","<sc.SqlInternalConnectionTds.Dispose|ADV> 311 disposing"
"2021-03-03T05:31:14.7418544Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 311, Disposed."
"2021-03-03T05:31:14.7418601Z",9927487
"2021-03-03T05:31:14.7419721Z","<prov.DbConnectionPool.PoolCreateRequest|RES|INFO|CPOOL> 134"
"2021-03-03T05:31:14.7419740Z","<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> 134"
"2021-03-03T05:31:14.7419763Z",462486
"2021-03-03T05:31:14.7468382Z","<prov.DbConnectionHelper.CreateDbCommand|API> 180782"
"2021-03-03T05:31:14.7468423Z","<sc.SqlCommand.set_Connection|API> 474911, 180782"
"2021-03-03T05:31:14.7468431Z",9927488
"2021-03-03T05:31:14.7468525Z","<sc.SqlCommand.set_CommandText|API> 474911, String Value = 'QUERY_TEXT'"
"2021-03-03T05:31:14.7468658Z","<sc.SqlConnection.OpenAsync|API> 180782"
"2021-03-03T05:31:14.7468712Z","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 180782, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1"
"2021-03-03T05:31:14.7468775Z","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 134, Getting connection."
"2021-03-03T05:31:14.7468861Z","<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 134, Connection 313, Popped from general pool."
"2021-03-03T05:31:14.7468978Z","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 313, Preparing to pop from pool,  owning connection 0, pooledCount=0"
"2021-03-03T05:31:14.7468991Z","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 313, Activating"
"2021-03-03T05:31:14.7469010Z",462487
"2021-03-03T05:31:14.7469079Z","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 474911, behavior=0, ActivityID 6cd20906-9364-4a5c-964c-ec5afce57eb9:1"
"2021-03-03T05:31:14.7469213Z","<sc.TdsParser.GetSession|ADV> 308 getting physical session 308"
"2021-03-03T05:31:14.7469308Z","<sc.SqlCommand.ExecuteReader|INFO> 474911, Command executed as RPC."
"2021-03-03T05:31:14.7469438Z","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>"
"2021-03-03T05:31:14.7469638Z",478026
"2021-03-03T05:31:14.7478537Z","<comm.ADP.TraceException|ERR|THROW> 'System.InvalidOperationException: The connection does not support MultipleActiveResultSets.'"
"2021-03-03T05:31:14.7479430Z","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID474911, ActivityID 8a720bab-d6ec-40e4-9901-0eae4f411637:1"
"2021-03-03T05:31:14.7497098Z","<sc.SqlConnection.Close|API> 180782"
"2021-03-03T05:31:14.7497130Z","<sc.SqlConnection.Close|API|Correlation> ObjectID 180782, ActivityID 8a720bab-d6ec-40e4-9901-0eae4f411637:1"
"2021-03-03T05:31:14.7497147Z","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 313 Closing."
"2021-03-03T05:31:14.7497174Z","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 313, Preparing to push into pool, owning connection 0, pooledCount=0"
"2021-03-03T05:31:14.7497189Z","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 134, Connection 313, Deactivating."
"2021-03-03T05:31:14.7497198Z","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 313, Deactivating"
"2021-03-03T05:31:14.7497208Z","<sc.SqlInternalConnection.Deactivate|ADV> 313 deactivating"
"2021-03-03T05:31:14.7497220Z","<prov.DbConnectionInternal.DoomThisConnection|RES|INFO|CPOOL> 313, Dooming"
"2021-03-03T05:31:14.7497230Z","<sc.TdsParser.Deactivate|ADV> 308 deactivating"
"2021-03-03T05:31:14.7497394Z","<sc.TdsParser.Deactivate|STATE> 308 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 1\n\t         _fMARS = 313\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False"
"2021-03-03T05:31:14.7497408Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 313, Removing from pool."
"2021-03-03T05:31:14.7497430Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 313, Removed from pool."
"2021-03-03T05:31:14.7497439Z","<sc.SqlInternalConnectionTds.Dispose|ADV> 313 disposing"
"2021-03-03T05:31:14.7498729Z","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 308, after decrementing _pendingCallbacks: 0"
"2021-03-03T05:31:14.7498744Z","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 134, Connection 313, Disposed."
"2021-03-03T05:31:14.7498862Z",9927489
"2021-03-03T05:31:14.7499373Z","<prov.DbConnectionPool.PoolCreateRequest|RES|INFO|CPOOL> 134"
"2021-03-03T05:31:14.7499392Z","<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> 134"
"2021-03-03T05:31:14.7499403Z",462488

@cheenamalhotra
Copy link
Member

There's a chunk of trace missing here (30 seconds) or is there literally no activity?
Secondly, I see no other entry of SqlCommand with Object Id 474906, maybe it started read a while ago? Can you find any other log for this SqlCommand object?

image

@cheenamalhotra
Copy link
Member

On the contrary, can you check and tell if your application is doing something like below, theoretically:

SqlConnection conn = new SqlConnection(connString);

try
{
    SqlCommand command = new SqlCommand("QUERY_TEXT", conn);
    // execute and read
}
catch { }

try
{
    // Continues to use old connection irrespective of whether last command failed with FATAL exception.
    SqlCommand command = new SqlCommand("ANOTHER QUERY_TEXT", conn);
    // execute and read
}
catch { }

Because from the logs if you see carefully, look at below lines:

// This is where 311 connection is doomed (forced killed due to FATAL CLASS (20) error)
"2021-03-03T05:31:14.7418023Z","<sc.SqlConnection.Close|API> 180782"

// Another commnd tries to use the same DEAD connection (Object 180782)
"2021-03-03T05:31:14.7468423Z","<sc.SqlCommand.set_Connection|API> 474911, 180782"

It seems that the same connection is still being used by your application in next command even when it failed with FATAL CLASS error which is non-retriable error class.

So there are 2 possibilities, for which you can provide more info:

  1. Application did not receive this FATAL error?
  2. Application swallows it somehow and continues to work with the same connection instance?

@lbargery
Copy link

@cheenamalhotra Don't think there are any extra logs in that 30 second window. This is how I'm capturing logs

public class SqlClientListener : EventListener
    {
        private readonly ConcurrentQueue<EventWrittenEventArgs> _logBuilder = new ConcurrentQueue<EventWrittenEventArgs>();

        public static async Task PerformWithSqlListening(Func<Task> fnPerform)
        {
            using var listener = new SqlClientListener();

            try
            {
                await fnPerform();
            }
            catch
            {
                foreach (var log in listener._logBuilder)
                {
                    LogWith.NoSampling(logger => logger.Information("SqlClient: {TimeStamp} {Level} {EventId} {ActivityID} {RelatedActivityID} {OpCode} {ThreadID} {Logs}",
                        log.TimeStamp, log.Level, log.EventId, log.ActivityId, log.RelatedActivityId, log.Opcode, log.OSThreadId, log.Payload?.ToCommaSeperated(x => x?.ToString())));
                }
                throw;
            }
        }

        protected override void OnEventSourceCreated(EventSource eventSource)
        {
            // Only enable events from SqlClientEventSource.
            if (eventSource.Name.Equals("Microsoft.Data.SqlClient.EventSource"))
            {
                //Capture all events, verbose
                EnableEvents(eventSource, EventLevel.Verbose, EventKeywords.All);
            }
        }

        // This callback runs whenever an event is written by SqlClientEventSource.
        // Event data is accessed through the EventWrittenEventArgs parameter.
        protected override void OnEventWritten(EventWrittenEventArgs eventData) => _logBuilder.Enqueue(eventData);
    }

The idea is that we only emit the verbose Sql client logs if an exception actually goes off. Let me know if we're using this wrong or misunderstood something though.

With regards to your re-using SQL connection, I can't be 100% sure but I would be very surprised. We don't interact at all with your raw library, we use EF core for all our database interactions. The context is passed into this azure function via dependency injection and we just execute a single query which immediately throws. Again not sure if helpful, but we've found that the EF core context seems to be broken after this particular exception, we can't perform an "outer" retry of the same query.

@lbargery
Copy link

lbargery commented Mar 12, 2021

I would have also expected if we were doing something like that, for this to go off more often. On the particular azure function we are logging, I see this error about 1-4 times a day (function is executing 100,000s of times a day)

@lbargery
Copy link

lbargery commented Mar 12, 2021

Have been searching for other instances of this where we have O(100s) of logs not O(10,000) and grabbed this one from more recent time. Have added a few extra columns in and this has our new TCP timeout so only goes over 2 mins or so not 15 mins.

Columns are time, activityID, message, OpCode, ThreadID, and log level

"TimeStamp_","customDimensions_ActivityID","customDimensions_Logs","customDimensions_OpCode","customDimensions_ThreadID","customDimensions_Level"
"2021-03-08T02:41:35.5237530Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.ConnectionString_Set|API> 1112968, 'Data Source=tcp:xxxx.database.windows.net,1433;Initial Catalog=xxxx;User Id=USER@xxxx.database.windows.net;Max Pool Size=200;ConnectRetryCount=0;MultipleActiveResultSets=False;'",Info,17717,Informational
"2021-03-08T02:41:35.5237559Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.CreateDbCommand|API> 1112968",Start,17717,Informational
"2021-03-08T02:41:35.5237587Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_Connection|API> 2686743, 1112968",Info,17717,Informational
"2021-03-08T02:41:35.5237593Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019525,Stop,17717,Informational
"2021-03-08T02:41:35.5237625Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_CommandText|API> 2686743, String Value = QUERY_TEXT",Info,17717,Informational
"2021-03-08T02:41:35.5237740Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API> 1112968",Start,17717,Informational
"2021-03-08T02:41:35.5237782Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 1112968, ActivityID 48f2c167-564f-4bc9-89b4-94b7c4924432:1",Start,17717,Informational
"2021-03-08T02:41:35.5237835Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Getting connection.",Info,17717,Informational
"2021-03-08T02:41:35.5237907Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 990, Connection 2000, Popped from general pool.",Info,17717,Informational
"2021-03-08T02:41:35.5238012Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 2000, Preparing to pop from pool,  owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:41:35.5238021Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 2000, Activating",Info,17717,Informational
"2021-03-08T02:41:35.5238040Z","ce75f166-d2f8-474b-a456-f95d9effc469",2616092,Stop,17717,Informational
"2021-03-08T02:41:35.5238093Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 2686743, behavior=0, ActivityID 48f2c167-564f-4bc9-89b4-94b7c4924432:1",Start,17717,Informational
"2021-03-08T02:41:35.5238219Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.GetSession|ADV> 1995 getting physical session 1995",Info,17717,Verbose
"2021-03-08T02:41:35.5238281Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.ExecuteReader|INFO> 2686743, Command executed as RPC.",Info,17717,Informational
"2021-03-08T02:41:35.5238376Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>",Start,17717,Informational
"2021-03-08T02:41:35.5238547Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706609,Stop,17717,Informational
"2021-03-08T02:41:35.5239608Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 1995, after incrementing _pendingCallbacks: 2",Info,17717,Verbose
"2021-03-08T02:41:35.5454418Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.ConnectionString_Set|API> 1112969, 'Data Source=tcp:xxxx.database.windows.net,1433;Initial Catalog=xxxx;User Id=USER@xxxx.database.windows.net;Max Pool Size=200;ConnectRetryCount=0;MultipleActiveResultSets=False;'",Info,17717,Informational
"2021-03-08T02:41:35.5454444Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.CreateDbCommand|API> 1112969",Start,17717,Informational
"2021-03-08T02:41:35.5454483Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_Connection|API> 2686744, 1112969",Info,17717,Informational
"2021-03-08T02:41:35.5454489Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019526,Stop,17717,Informational
"2021-03-08T02:41:35.5454519Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_CommandText|API> 2686744, String Value = QUERY_TEXT",Info,17717,Informational
"2021-03-08T02:41:35.5454610Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API> 1112969",Start,17717,Informational
"2021-03-08T02:41:35.5454681Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 1112969, ActivityID 60500dab-accd-4301-9c05-33ccfbe9f478:1",Start,17717,Informational
"2021-03-08T02:41:35.5454749Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Getting connection.",Info,17717,Informational
"2021-03-08T02:41:35.5454813Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Wait timed out.",Info,17717,Informational
"2021-03-08T02:41:35.5456242Z","ce75f166-d2f8-474b-a456-f95d9effc469",2616093,Stop,17717,Informational
"2021-03-08T02:41:35.5457075Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Getting connection.",Info,17717,Informational
"2021-03-08T02:41:35.5457177Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Creating new connection.",Info,17717,Informational
"2021-03-08T02:41:35.5457250Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.LoginNoFailover|ADV> 2001, host=tcp:xxxx.database.windows.net,1433",Info,17717,Verbose
"2021-03-08T02:41:35.5457297Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 1996, after incrementing _pendingCallbacks: 1",Info,17717,Verbose
"2021-03-08T02:41:35.5457326Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.AttemptOneLogin|ADV> 2001, timout=14999[msec], server=tcp:xxxx.database.windows.net,1433",Info,17717,Verbose
"2021-03-08T02:41:35.5457365Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Connect|SEC> SQL authentication",Info,17717,Informational
"2021-03-08T02:41:35.5669438Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.ConnectionString_Set|API> 1112970, 'Data Source=tcp:xxxx.database.windows.net,1433;Initial Catalog=xxxx;User Id=USER@xxxx.database.windows.net;Max Pool Size=200;ConnectRetryCount=0;MultipleActiveResultSets=False;'",Info,17717,Informational
"2021-03-08T02:41:35.5669466Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.CreateDbCommand|API> 1112970",Start,17717,Informational
"2021-03-08T02:41:35.5669492Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_Connection|API> 2686745, 1112970",Info,17717,Informational
"2021-03-08T02:41:35.5669499Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019527,Stop,17717,Informational
"2021-03-08T02:41:35.5669556Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_CommandText|API> 2686745, String Value = QUERY_TEXT",Info,17717,Informational
"2021-03-08T02:41:35.5669646Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API> 1112970",Start,17717,Informational
"2021-03-08T02:41:35.5669689Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 1112970, ActivityID 60500dab-accd-4301-9c05-33ccfbe9f478:1",Start,17717,Informational
"2021-03-08T02:41:35.5669748Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Getting connection.",Info,17717,Informational
"2021-03-08T02:41:35.5669803Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Wait timed out.",Info,17717,Informational
"2021-03-08T02:41:35.5669863Z","ce75f166-d2f8-474b-a456-f95d9effc469",2616094,Stop,17717,Informational
"2021-03-08T02:41:35.5827703Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Connect|SEC> Sending prelogin handshake",Info,17717,Informational
"2021-03-08T02:41:35.5828112Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.SendPreLoginHandshake|INFO> ClientConnectionID 8a971da9-3c62-4e79-a64b-b983226b9159, ActivityID 5411d396-bf05-4350-9d4b-12756733560a:1",Info,17717,Informational
"2021-03-08T02:41:35.5829023Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Connect|SEC> Consuming prelogin handshake",Info,17717,Informational
"2021-03-08T02:41:35.5845474Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Write |SNI|INFO|SCOPE> writing encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5845776Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706610,Stop,17717,Informational
"2021-03-08T02:41:35.5845797Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5880562Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706611,Stop,17717,Informational
"2021-03-08T02:41:35.5880682Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5880725Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706612,Stop,17717,Informational
"2021-03-08T02:41:35.5880733Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5880785Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706613,Stop,17717,Informational
"2021-03-08T02:41:35.5885813Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Write |SNI|INFO|SCOPE> writing encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5886207Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706614,Stop,17717,Informational
"2021-03-08T02:41:35.5886223Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5902950Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706615,Stop,17717,Informational
"2021-03-08T02:41:35.5902981Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5903004Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706616,Stop,17717,Informational
"2021-03-08T02:41:35.5903141Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5903168Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706617,Stop,17717,Informational
"2021-03-08T02:41:35.5903177Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.Read |SNI|INFO|SCOPE> reading encapsulated bytes",Start,17717,Informational
"2021-03-08T02:41:35.5903210Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706618,Stop,17717,Informational
"2021-03-08T02:41:35.5912450Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SNICommon.ValidateSslServerCertificate |SNI|SCOPE|INFO >",Start,17717,Informational
"2021-03-08T02:41:35.5912479Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SNICommon.ValidateSslServerCertificate |SNI|INFO > SSL Server certificate validated.",Info,17717,Informational
"2021-03-08T02:41:35.5912515Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706619,Stop,17717,Informational
"2021-03-08T02:41:35.5912583Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SslOverTdsStream.FinishHandshake |SNI|INFO> switched from encapsulation to passthrough mode",Info,17717,Informational
"2021-03-08T02:41:35.5912698Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.TdsLogin|ADV> 1996, TDS Login7 flags = 268436448:",Info,17717,Verbose
"2021-03-08T02:41:35.6244396Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.Cancel | API > 2686743",Start,17717,Informational
"2021-03-08T02:41:35.6244467Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.Cancel|API|Correlation> ObjectID 2686743, ActivityID 60500dab-accd-4301-9c05-33ccfbe9f478:1",Start,17717,Informational
"2021-03-08T02:41:35.6245099Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.SendAttention|INFO> Send Attention ASync.",Info,17717,Informational
"2021-03-08T02:41:35.6245135Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.WritePacket|INFO|ADV>  Packet sent",Info,17717,Verbose
"2021-03-08T02:41:35.6245140Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.SendAttention|INFO> Attention sent to the server.",Info,17717,Informational
"2021-03-08T02:41:35.6245147Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019528,Stop,17717,Informational
"2021-03-08T02:41:35.6446730Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsyncRetry|Info> 1112969",Info,17717,Informational
"2021-03-08T02:41:35.6690922Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsyncRetry|Info> 1112970",Info,17717,Informational
"2021-03-08T02:41:35.6749397Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.TryRun|SEC> Received login acknowledgement token",Info,17717,Informational
"2021-03-08T02:41:35.6749527Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 2001, Received feature extension acknowledgement for TCE",Info,17717,Verbose
"2021-03-08T02:41:35.6749548Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 2001, Received feature extension acknowledgement for GlobalTransactions",Info,17717,Verbose
"2021-03-08T02:41:35.6749565Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 2001, Received feature extension acknowledgement for DATACLASSIFICATION",Info,17717,Verbose
"2021-03-08T02:41:35.6749580Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 2001, Received feature extension acknowledgement for UTF8 support",Info,17717,Verbose
"2021-03-08T02:41:35.6749599Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.OnFeatureExtAck|ADV> 2001, Received feature extension acknowledgement for SQLDNSCACHING",Info,17717,Verbose
"2021-03-08T02:41:35.6749790Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.CompleteLogin|ADV> Post-Login Phase: Server connection obtained.",Info,17717,Verbose
"2021-03-08T02:41:35.6749868Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc|ActiveDirectoryAuthenticationTimeoutRetryHelper|SetState|Info>State changed from NotStarted to HasLoggedIn.",Info,17717,Informational
"2021-03-08T02:41:35.6749896Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.ctor|ADV> 2001, constructed new TDS internal connection",Info,17717,Verbose
"2021-03-08T02:41:35.6749917Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionFactory.CreatePooledConnection|RES|CPOOL> 1, Pooled database connection created.",Info,17717,Informational
"2021-03-08T02:41:35.6749955Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 2001, Preparing to push into pool, owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:41:35.6749986Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.CreateObject|RES|CPOOL> 990, Connection 2001, Added to pool.",Info,17717,Informational
"2021-03-08T02:41:35.6750045Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 2001, Preparing to pop from pool,  owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:41:35.6750059Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 2001, Activating",Info,17717,Informational
"2021-03-08T02:41:35.6750083Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 2001, Preparing to push into pool, owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:41:35.6750099Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 990, Connection 2001, Deactivating.",Info,17717,Informational
"2021-03-08T02:41:35.6750113Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 2001, Deactivating",Info,17717,Informational
"2021-03-08T02:41:35.6750127Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnection.Deactivate|ADV> 2001 deactivating",Info,17717,Verbose
"2021-03-08T02:41:35.6750141Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|ADV> 1996 deactivating",Info,17717,Verbose
"2021-03-08T02:41:35.6750339Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|STATE> 1996 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 0\n\t         _fMARS = 2001\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False",Info,17717,Verbose
"2021-03-08T02:41:35.6750360Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 990, Connection 2001, Pushing to general pool.",Info,17717,Informational
"2021-03-08T02:41:35.7498071Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.CreateDbCommand|API> 1112969",Start,17717,Informational
"2021-03-08T02:41:35.7498123Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_Connection|API> 2686746, 1112969",Info,17717,Informational
"2021-03-08T02:41:35.7498134Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019529,Stop,17717,Informational
"2021-03-08T02:41:35.7498198Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_CommandText|API> 2686746, String Value = QUERY_TEXT",Info,17717,Informational
"2021-03-08T02:41:35.7498311Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API> 1112969",Start,17717,Informational
"2021-03-08T02:41:35.7498368Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 1112969, ActivityID 60500dab-accd-4301-9c05-33ccfbe9f478:1",Start,17717,Informational
"2021-03-08T02:41:35.7498441Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Getting connection.",Info,17717,Informational
"2021-03-08T02:41:35.7498523Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 990, Connection 2001, Popped from general pool.",Info,17717,Informational
"2021-03-08T02:41:35.7498640Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 2001, Preparing to pop from pool,  owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:41:35.7498653Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 2001, Activating",Info,17717,Informational
"2021-03-08T02:41:35.7498674Z","ce75f166-d2f8-474b-a456-f95d9effc469",2616095,Stop,17717,Informational
"2021-03-08T02:41:35.7498763Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 2686746, behavior=0, ActivityID 60500dab-accd-4301-9c05-33ccfbe9f478:1",Start,17717,Informational
"2021-03-08T02:41:35.7498908Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.GetSession|ADV> 1996 getting physical session 1996",Info,17717,Verbose
"2021-03-08T02:41:35.7498977Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.ExecuteReader|INFO> 2686746, Command executed as RPC.",Info,17717,Informational
"2021-03-08T02:41:35.7499084Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>",Start,17717,Informational
"2021-03-08T02:41:35.7499271Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706620,Stop,17717,Informational
"2021-03-08T02:41:35.7500821Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 1996, after incrementing _pendingCallbacks: 2",Info,17717,Verbose
"2021-03-08T02:41:35.7536869Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 1996, after decrementing _pendingCallbacks: 1",Info,17717,Verbose
"2021-03-08T02:41:35.7537184Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID2686746, ActivityID 8b629d68-cce4-41ee-9a2e-d50fe030d10e:1",Start,17717,Informational
"2021-03-08T02:41:35.7537404Z","ce75f166-d2f8-474b-a456-f95d9effc469","22690958, 1, 0",Stop,17717,Informational
"2021-03-08T02:41:35.7538454Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.ReadAsync|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538466Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Read|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538492Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> 1996, NBCROW bitmap received, column count = 18",Info,17717,Verbose
"2021-03-08T02:41:35.7538528Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> NBCROW bitmap data:",Info,17717,Verbose
"2021-03-08T02:41:35.7538535Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019531,Stop,17717,Informational
"2021-03-08T02:41:35.7538694Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019530,Stop,17717,Informational
"2021-03-08T02:41:35.7538769Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.ReadAsync|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538782Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Read|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538792Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019533,Stop,17717,Informational
"2021-03-08T02:41:35.7538799Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019532,Stop,17717,Informational
"2021-03-08T02:41:35.7538823Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.NextResultAsync|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538841Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.NextResult|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538877Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Read|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538882Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019536,Stop,17717,Informational
"2021-03-08T02:41:35.7538893Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019535,Stop,17717,Informational
"2021-03-08T02:41:35.7538899Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019534,Stop,17717,Informational
"2021-03-08T02:41:35.7538908Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Close|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538920Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019537,Stop,17717,Informational
"2021-03-08T02:41:35.7538927Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Close|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7538931Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019538,Stop,17717,Informational
"2021-03-08T02:41:35.7539669Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API> 1112969",Start,17717,Informational
"2021-03-08T02:41:35.7539695Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API|Correlation> ObjectID 1112969, ActivityID 8b629d68-cce4-41ee-9a2e-d50fe030d10e:1",Start,17717,Informational
"2021-03-08T02:41:35.7539712Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 2001 Closing.",Info,17717,Informational
"2021-03-08T02:41:35.7539738Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 2001, Preparing to push into pool, owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:41:35.7539767Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 990, Connection 2001, Deactivating.",Info,17717,Informational
"2021-03-08T02:41:35.7539778Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 2001, Deactivating",Info,17717,Informational
"2021-03-08T02:41:35.7539789Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnection.Deactivate|ADV> 2001 deactivating",Info,17717,Verbose
"2021-03-08T02:41:35.7539802Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|ADV> 1996 deactivating",Info,17717,Verbose
"2021-03-08T02:41:35.7539955Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|STATE> 1996 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 0\n\t         _fMARS = 2001\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False",Info,17717,Verbose
"2021-03-08T02:41:35.7539973Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 990, Connection 2001, Pushing to general pool.",Info,17717,Informational
"2021-03-08T02:41:35.7540022Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019539,Stop,17717,Informational
"2021-03-08T02:41:35.7543123Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API> 1112969",Start,17717,Informational
"2021-03-08T02:41:35.7543147Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API|Correlation> ObjectID 1112969, ActivityID 8b629d68-cce4-41ee-9a2e-d50fe030d10e:1",Start,17717,Informational
"2021-03-08T02:41:35.7543161Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019540,Stop,17717,Informational
"2021-03-08T02:41:35.7741377Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.CreateDbCommand|API> 1112970",Start,17717,Informational
"2021-03-08T02:41:35.7741412Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_Connection|API> 2686747, 1112970",Info,17717,Informational
"2021-03-08T02:41:35.7741419Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019541,Stop,17717,Informational
"2021-03-08T02:41:35.7741475Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_CommandText|API> 2686747, String Value = QUERY_TEXT",Info,17717,Informational
"2021-03-08T02:41:35.7741556Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API> 1112970",Start,17717,Informational
"2021-03-08T02:41:35.7741595Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 1112970, ActivityID 8b629d68-cce4-41ee-9a2e-d50fe030d10e:1",Start,17717,Informational
"2021-03-08T02:41:35.7741652Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Getting connection.",Info,17717,Informational
"2021-03-08T02:41:35.7741725Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 990, Connection 2001, Popped from general pool.",Info,17717,Informational
"2021-03-08T02:41:35.7741810Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 2001, Preparing to pop from pool,  owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:41:35.7741823Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 2001, Activating",Info,17717,Informational
"2021-03-08T02:41:35.7741841Z","ce75f166-d2f8-474b-a456-f95d9effc469",2616096,Stop,17717,Informational
"2021-03-08T02:41:35.7741916Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 2686747, behavior=0, ActivityID 8b629d68-cce4-41ee-9a2e-d50fe030d10e:1",Start,17717,Informational
"2021-03-08T02:41:35.7742024Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.GetSession|ADV> 1996 getting physical session 1996",Info,17717,Verbose
"2021-03-08T02:41:35.7742079Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.ExecuteReader|INFO> 2686747, Command executed as RPC.",Info,17717,Informational
"2021-03-08T02:41:35.7742164Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>",Start,17717,Informational
"2021-03-08T02:41:35.7742339Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706621,Stop,17717,Informational
"2021-03-08T02:41:35.7743477Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.IncrementPendingCallbacks|ADV> 1996, after incrementing _pendingCallbacks: 2",Info,17717,Verbose
"2021-03-08T02:41:35.7799688Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 1996, after decrementing _pendingCallbacks: 1",Info,17717,Verbose
"2021-03-08T02:41:35.7800016Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID2686747, ActivityID 59a4b2c8-4450-4585-99f8-134cf965c51f:1",Start,17717,Informational
"2021-03-08T02:41:35.7800217Z","ce75f166-d2f8-474b-a456-f95d9effc469","8578297, 1, 0",Stop,17717,Informational
"2021-03-08T02:41:35.7802414Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.ReadAsync|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802432Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Read|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802464Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> 1996, NBCROW bitmap received, column count = 18",Info,17717,Verbose
"2021-03-08T02:41:35.7802506Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.NullBitmap.Initialize|INFO|ADV> NBCROW bitmap data:",Info,17717,Verbose
"2021-03-08T02:41:35.7802515Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019543,Stop,17717,Informational
"2021-03-08T02:41:35.7802700Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019542,Stop,17717,Informational
"2021-03-08T02:41:35.7802766Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.ReadAsync|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802783Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Read|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802794Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019545,Stop,17717,Informational
"2021-03-08T02:41:35.7802801Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019544,Stop,17717,Informational
"2021-03-08T02:41:35.7802824Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.NextResultAsync|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802840Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.NextResult|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802849Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Read|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802853Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019548,Stop,17717,Informational
"2021-03-08T02:41:35.7802867Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019547,Stop,17717,Informational
"2021-03-08T02:41:35.7802874Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019546,Stop,17717,Informational
"2021-03-08T02:41:35.7802885Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Close|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802905Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019549,Stop,17717,Informational
"2021-03-08T02:41:35.7802915Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlDataReader.Close|API> 1",Start,17717,Informational
"2021-03-08T02:41:35.7802919Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019550,Stop,17717,Informational
"2021-03-08T02:41:35.7803604Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API> 1112970",Start,17717,Informational
"2021-03-08T02:41:35.7803643Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API|Correlation> ObjectID 1112970, ActivityID 8b629d68-cce4-41ee-9a2e-d50fe030d10e:1",Start,17717,Informational
"2021-03-08T02:41:35.7803661Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 2001 Closing.",Info,17717,Informational
"2021-03-08T02:41:35.7803691Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 2001, Preparing to push into pool, owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:41:35.7803708Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 990, Connection 2001, Deactivating.",Info,17717,Informational
"2021-03-08T02:41:35.7803722Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 2001, Deactivating",Info,17717,Informational
"2021-03-08T02:41:35.7803734Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnection.Deactivate|ADV> 2001 deactivating",Info,17717,Verbose
"2021-03-08T02:41:35.7803749Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|ADV> 1996 deactivating",Info,17717,Verbose
"2021-03-08T02:41:35.7803927Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|STATE> 1996 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 0\n\t         _fMARS = 2001\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False",Info,17717,Verbose
"2021-03-08T02:41:35.7803948Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.PutNewObject|RES|CPOOL> 990, Connection 2001, Pushing to general pool.",Info,17717,Informational
"2021-03-08T02:41:35.7803989Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019551,Stop,17717,Informational
"2021-03-08T02:41:35.7806970Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API> 1112970",Start,17717,Informational
"2021-03-08T02:41:35.7807000Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API|Correlation> ObjectID 1112970, ActivityID 8b629d68-cce4-41ee-9a2e-d50fe030d10e:1",Start,17717,Informational
"2021-03-08T02:41:35.7807014Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019552,Stop,17717,Informational
"2021-03-08T02:41:39.6445777Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1",Info,17717,Verbose
"2021-03-08T02:42:09.6436332Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1",Info,17717,Verbose
"2021-03-08T02:42:39.6438011Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1",Info,17717,Verbose
"2021-03-08T02:43:09.6433661Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionFactory.PruneConnectionPoolGroups|RES|INFO|CPOOL> 1",Info,17717,Verbose
"2021-03-08T02:43:26.4276215Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SNILoadHandle.LastError |SNI|INFO|SETTER > Last Error Value = Microsoft.Data.SqlClient.SNI.SNIError",Info,17717,Informational
"2021-03-08T02:43:26.4295351Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.ProcessSNIError|ERR>",Start,17717,Informational
"2021-03-08T02:43:26.4301202Z","ce75f166-d2f8-474b-a456-f95d9effc469","< sc.TdsParser.ProcessSNIError |ERR|ADV > Error message Detail:",Info,17717,Verbose
"2021-03-08T02:43:26.4306363Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.ProcessSNIError |ERR|ADV > Empty error message received from SNI. Error Message = , SNI Error Number =35",Info,17717,Verbose
"2021-03-08T02:43:26.4311923Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.ProcessSNIError |ERR|ADV > SNI Native Error Code = 0",Info,17717,Verbose
"2021-03-08T02:43:26.4333073Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.ProcessSNIError |ERR|ADV > SNI Error Message. Native Error = 0, Line Number =0, Function =, Exception =System.IO.IOException: Unable to read data from the transport connection: Connection timed out.\n ---> System.Net.Sockets.SocketException (110): Connection timed out\n   --- End of inner exception stack trace ---\n   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)\n   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)\n   at Microsoft.Data.SqlClient.SNI.SslOverTdsStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)\n   at System.Net.Security.SslStream.<FillBufferAsync>g__InternalFillBufferAsync|215_0[TReadAdapter](TReadAdapter adap, ValueTask`1 task, Int32 min, Int32 initial)\n   at System.Net.Security.SslStream.ReadAsyncInternal[TReadAdapter](TReadAdapter adapter, Memory`1 buffer)\n   at Microsoft.Data.SqlClient.SNI.SNISslStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken), Server = tcp:xxxx.database.windows.net,1433",Info,17717,Error
"2021-03-08T02:43:26.4333114Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlError.SqlError|ERR> infoNumber=0, errorState=0, errorClass=20, errorMessage='A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 35 - An internal exception was caught)', procedure='', lineNumber=0",Info,17717,Informational
"2021-03-08T02:43:26.4333126Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019553,Stop,17717,Informational
"2021-03-08T02:43:26.4333161Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 1995, after decrementing _pendingCallbacks: 1",Info,17717,Verbose
"2021-03-08T02:43:26.4340790Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DoomThisConnection|RES|INFO|CPOOL> 2000, Dooming",Info,17717,Informational
"2021-03-08T02:43:26.4340997Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID2686743, ActivityID 59a4b2c8-4450-4585-99f8-134cf965c51f:1",Start,17717,Informational
"2021-03-08T02:43:26.4345685Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 1995, after decrementing _pendingCallbacks: 0",Info,17717,Verbose
"2021-03-08T02:43:26.4348896Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OnError|INFO> 1112968, Connection broken.",Info,17717,Informational
"2021-03-08T02:43:26.4348917Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API> 1112968",Start,17717,Informational
"2021-03-08T02:43:26.4349008Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API|Correlation> ObjectID 1112968, ActivityID 8b629d68-cce4-41ee-9a2e-d50fe030d10e:1",Start,17717,Informational
"2021-03-08T02:43:26.4349030Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 2000 Closing.",Info,17717,Informational
"2021-03-08T02:43:26.4349066Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 2000, Preparing to push into pool, owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:43:26.4349086Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 990, Connection 2000, Deactivating.",Info,17717,Informational
"2021-03-08T02:43:26.4349097Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 2000, Deactivating",Info,17717,Informational
"2021-03-08T02:43:26.4349108Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnection.Deactivate|ADV> 2000 deactivating",Info,17717,Verbose
"2021-03-08T02:43:26.4349171Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DoomThisConnection|RES|INFO|CPOOL> 2000, Dooming",Info,17717,Informational
"2021-03-08T02:43:26.4349182Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|ADV> 1995 deactivating",Info,17717,Verbose
"2021-03-08T02:43:26.4349512Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|STATE> 1995 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = Broken\n\t         _server = tcp:xxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 1\n\t         _fMARS = 2000\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False",Info,17717,Verbose
"2021-03-08T02:43:26.4349529Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 990, Connection 2000, Removing from pool.",Info,17717,Informational
"2021-03-08T02:43:26.4349568Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 990, Connection 2000, Removed from pool.",Info,17717,Informational
"2021-03-08T02:43:26.4349577Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.Dispose|ADV> 2000 disposing",Info,17717,Verbose
"2021-03-08T02:43:26.4349593Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 990, Connection 2000, Disposed.",Info,17717,Informational
"2021-03-08T02:43:26.4349598Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.BreakConnection|RES|CPOOL> 2000, Breaking connection.",Info,17717,Informational
"2021-03-08T02:43:26.4349618Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DoomThisConnection|RES|INFO|CPOOL> 2000, Dooming",Info,17717,Informational
"2021-03-08T02:43:26.4349815Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019554,Stop,17717,Informational
"2021-03-08T02:43:26.4349865Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API> 1112968",Start,17717,Informational
"2021-03-08T02:43:26.4349898Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API|Correlation> ObjectID 1112968, ActivityID 59a4b2c8-4450-4585-99f8-134cf965c51f:1",Start,17717,Informational
"2021-03-08T02:43:26.4349914Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019555,Stop,17717,Informational
"2021-03-08T02:43:26.4350992Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.PoolCreateRequest|RES|INFO|CPOOL> 990",Start,17717,Informational
"2021-03-08T02:43:26.4351008Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> 990",Info,17717,Informational
"2021-03-08T02:43:26.4351034Z","ce75f166-d2f8-474b-a456-f95d9effc469",2616097,Stop,17717,Informational
"2021-03-08T02:43:26.4389199Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionHelper.CreateDbCommand|API> 1112968",Start,17717,Informational
"2021-03-08T02:43:26.4389230Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_Connection|API> 2686748, 1112968",Info,17717,Informational
"2021-03-08T02:43:26.4389236Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019556,Stop,17717,Informational
"2021-03-08T02:43:26.4389285Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.set_CommandText|API> 2686748, String Value = QUERY_TEXT",Info,17717,Informational
"2021-03-08T02:43:26.4389369Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API> 1112968",Start,17717,Informational
"2021-03-08T02:43:26.4389399Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.OpenAsync|API|Correlation> ObjectID 1112968, ActivityID 59a4b2c8-4450-4585-99f8-134cf965c51f:1",Start,17717,Informational
"2021-03-08T02:43:26.4389444Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetConnection|RES|CPOOL> 990, Getting connection.",Info,17717,Informational
"2021-03-08T02:43:26.4389503Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.GetFromGeneralPool|RES|CPOOL> 990, Connection 2001, Popped from general pool.",Info,17717,Informational
"2021-03-08T02:43:26.4389589Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PostPop|RES|CPOOL> 2001, Preparing to pop from pool,  owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:43:26.4389599Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.ActivateConnection|RES|INFO|CPOOL> 2001, Activating",Info,17717,Informational
"2021-03-08T02:43:26.4389619Z","ce75f166-d2f8-474b-a456-f95d9effc469",2616098,Stop,17717,Informational
"2021-03-08T02:43:26.4389685Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.ExecuteReaderAsync|API|Correlation> ObjectID 2686748, behavior=0, ActivityID 59a4b2c8-4450-4585-99f8-134cf965c51f:1",Start,17717,Informational
"2021-03-08T02:43:26.4389780Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.GetSession|ADV> 1996 getting physical session 1996",Info,17717,Verbose
"2021-03-08T02:43:26.4389836Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.ExecuteReader|INFO> 2686748, Command executed as RPC.",Info,17717,Informational
"2021-03-08T02:43:26.4389923Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SNI.SNIMarsHandle.SendAsync |SNI|INFO|SCOPE>",Start,17717,Informational
"2021-03-08T02:43:26.4389959Z","ce75f166-d2f8-474b-a456-f95d9effc469",2706622,Stop,17717,Informational
"2021-03-08T02:43:26.4397679Z","ce75f166-d2f8-474b-a456-f95d9effc469","<comm.ADP.TraceException|ERR|THROW> 'System.InvalidOperationException: The connection does not support MultipleActiveResultSets.'",Info,17717,Informational
"2021-03-08T02:43:26.4398517Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlCommand.EndExecuteReaderAsync|Info|Correlation> ObjectID2686748, ActivityID 0395a767-571f-4a8d-b39e-e9d26e916f8a:1",Start,17717,Informational
"2021-03-08T02:43:26.4411719Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API> 1112968",Start,17717,Informational
"2021-03-08T02:43:26.4411754Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlConnection.Close|API|Correlation> ObjectID 1112968, ActivityID 0395a767-571f-4a8d-b39e-e9d26e916f8a:1",Start,17717,Informational
"2021-03-08T02:43:26.4411771Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.CloseConnection|RES|CPOOL> 2001 Closing.",Info,17717,Informational
"2021-03-08T02:43:26.4411799Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.PrePush|RES|CPOOL> 2001, Preparing to push into pool, owning connection 0, pooledCount=0",Info,17717,Informational
"2021-03-08T02:43:26.4411813Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DeactivateObject|RES|CPOOL> 990, Connection 2001, Deactivating.",Info,17717,Informational
"2021-03-08T02:43:26.4411824Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DeactivateConnection|RES|INFO|CPOOL> 2001, Deactivating",Info,17717,Informational
"2021-03-08T02:43:26.4411834Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnection.Deactivate|ADV> 2001 deactivating",Info,17717,Verbose
"2021-03-08T02:43:26.4411846Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionInternal.DoomThisConnection|RES|INFO|CPOOL> 2001, Dooming",Info,17717,Informational
"2021-03-08T02:43:26.4411859Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|ADV> 1996 deactivating",Info,17717,Verbose
"2021-03-08T02:43:26.4412017Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParser.Deactivate|STATE> 1996 \n\t         _physicalStateObj = False\n\t         _pMarsPhysicalConObj = True\n\t         _state = OpenLoggedIn\n\t         _server = tcp:xxxx.database.windows.net,1433\n\t         _fResetConnection = False\n\t         _defaultCollation = (LCID=1033, Opts=25)\n\t         _defaultCodePage = 1252\n\t         _defaultLCID = 1033\n\t         _defaultEncoding = System.Text.SBCSCodePageEncoding\n\t         _encryptionOption = \n\t         _currentTransaction = ON\n\t         _pendingTransaction = (null)\n\t         _retainedTransactionId = (null)\n\t         _nonTransactedOpenResultCount = 0\n\t         _connHandler = 1\n\t         _fMARS = 2001\n\t         _sessionPool = False\n\t         _isYukon = (null)\n\t         _sniSpnBuffer = True\n\t         _errors = (null)\n\t         _warnings = (null)\n\t         _attentionErrors = (null)\n\t         _attentionWarnings = (null)\n\t         _statistics = (null)\n\t         _statisticsIsInTransaction = True\n\t         _fPreserveTransaction = False         _fParallel = False",Info,17717,Verbose
"2021-03-08T02:43:26.4412032Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 990, Connection 2001, Removing from pool.",Info,17717,Informational
"2021-03-08T02:43:26.4412058Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 990, Connection 2001, Removed from pool.",Info,17717,Informational
"2021-03-08T02:43:26.4412067Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.SqlInternalConnectionTds.Dispose|ADV> 2001 disposing",Info,17717,Verbose
"2021-03-08T02:43:26.4413194Z","ce75f166-d2f8-474b-a456-f95d9effc469","<sc.TdsParserStateObject.DecrementPendingCallbacks|ADV> 1996, after decrementing _pendingCallbacks: 0",Info,17717,Verbose
"2021-03-08T02:43:26.4413208Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.DestroyObject|RES|CPOOL> 990, Connection 2001, Disposed.",Info,17717,Informational
"2021-03-08T02:43:26.4413315Z","ce75f166-d2f8-474b-a456-f95d9effc469",55019557,Stop,17717,Informational
"2021-03-08T02:43:26.4413906Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.PoolCreateRequest|RES|INFO|CPOOL> 990",Start,17717,Informational
"2021-03-08T02:43:26.4413924Z","ce75f166-d2f8-474b-a456-f95d9effc469","<prov.DbConnectionPool.ReclaimEmancipatedObjects|RES|CPOOL> 990",Info,17717,Informational
"2021-03-08T02:43:26.4413933Z","ce75f166-d2f8-474b-a456-f95d9effc469",2616099,Stop,17717,Informational

@cheenamalhotra
Copy link
Member

Hi @lbargery

I can advise a quick workaround for you in this case to ensure this does not block you. You can try to create a new connection instance when you capture Fatal Error class 20 on query execution, i.e. "A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 35 - An internal exception was caught)"

Please re-initialize SqlConnection instance in DBContext in this case, and that should resolve your case.
Let me know if that works for you for time being.

I'll continue to investigate and find root cause to fix this issue properly so connection stays usable again.

@lbargery
Copy link

@cheenamalhotra

Thanks for the work-around. Just to check I'm understanding correctly, in our application code layer we'd catch the MARs exception (we don't see the TCP one) right? Apologies if I'm being slow but how do you re-initialize the sql connection instance in a db context?

Thanks for all your help - happy to provide as much detail as we can - appreciate this is a tricky one to debug without a repo!

@lbargery
Copy link

Added the following in our custom retry strategy for SQL, hopefully this is what you mean where I've closed and re-opened the connection:

try
{
    return await base.ExecuteAsync(state, _WithContextAsync(operation), verifySucceeded, cancellationToken);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("The connection does not support MultipleActiveResultSets."))
{
    return await base.ExecuteAsync(state, async (c, s, t) =>
    {
        await c.Database.CloseConnectionAsync();
        await c.Database.OpenConnectionAsync(cancellationToken: t);
         var result = await operation(c, s, t);
        LogWith.NoSampling(l => l.Information("Post MARS error connection reset success"));
        return result;
    }, verifySucceeded, cancellationToken);
}

@lbargery
Copy link

@cheenamalhotra We managed to get it to work using the follow after the closeAysnc. Seems like re-open didn't actually reset the state. So this (for now) seems to "solve" the issue for us (though will keep monitoring in Prod)

#pragma warning disable EF1001 // Internal EF Core API usage.
  var dependencies = ((IDatabaseFacadeDependenciesAccessor)dbFacade).Dependencies;
  if (dependencies is IRelationalDatabaseFacadeDependencies relationalDependencies)
  {
      var rc = relationalDependencies.RelationalConnection;
      rc.Dispose();
  }

@cheenamalhotra
Copy link
Member

how do you re-initialize the sql connection instance in a db context?

I simply meant to drop connection and recreate it by disposing/re-initializing DbContext.

So this (for now) seems to "solve" the issue for us (though will keep monitoring in Prod)

Is it possible to Dispose and re-create a new instance of DbContext instead of going deep down in EF Core and disposing connection?

@lbargery
Copy link

@cheenamalhotra I'm not sure if that's possible. I can definitely dispose the context in that method but I'm not sure how I could create a new one. The method isn't even generic on the DbContext it just passes in the concrete base type so I don't know how you'd even know what type to re-construct?

The above code (whilst a bit dirty) seems to have worked well in production today FYI.

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Mar 17, 2021

Hi @lbargery

I'm able to reproduce this issue locally with just a simple code and a little modification in the driver:

Repro Code:

    using (SqlConnection sqlConnection = new SqlConnection(connString))
    {
        // Execute 2 commands - should work.
        for (int i = 0; i < 2; i++)
        {
            sqlConnection.Open(); // Throws exception second time.
            using (SqlCommand cmd = new SqlCommand("SELECT @@VERSION", sqlConnection))
            {
                cmd.CommandText = "SELECT @@VERSION";
                try
                {
                    using (var reader = await cmd.ExecuteReaderAsync())
                    {
                        while (await reader.ReadAsync())
                        { }
                    }
                    Console.WriteLine(i + 1 + " passed");
                }
                catch (SqlException e)
                {
                    Console.WriteLine(i + 1 + " " + e.Message);
                }
            }
        }
    }

Driver modification in SNIStreams.cs#L34 [Force SocketException on ReadAsync]

internal class SNISslStream : SslStream
{
    ...
    public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
    {
        await _readAsyncSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
        try
        {
            //return await base.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false);
            throw new SocketException();
        }
        finally
        {
            _readAsyncSemaphore.Release();
        }
    }
...

Output:

image

I sometimes also get UnhandledException (if it happens on EndExecuteReaderAsync):

image

And as you can see I'm not doing anything special except forcing driver to behave as if socket is not able to read anything from network, mocking the behavior as captured in traces above. What we see here is:

  1. We're able to capture exception in first round of query execution, so error: 35 - An internal exception was caught is captured, which also has a Class of 20 (tried printing).
  2. If you modify the code to dispose and re-open connection, it works normally again. That's why Dispose works in your case, as it allows driver to establish a fresh new connection instance and hence it's a safe approach.

Given the fact that the first exception is a FATAL exception (Class 20), and internal connection and parser are no longer connected to server, as of now there is no way you can continue working on this connection instance.

I'm still yet to determine if it should be possible to recover in this state and reconnect silently if new command needs to be executed, but it will be tricky as currently driver does not behave that way.

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Mar 17, 2021

The error message in second query is misleading which is due to a bug in async flow, but the connection is not usable eitherway.
If I try to fix the bug, the second message would be like:

System.InvalidOperationException: Invalid operation. The connection is closed.
at Microsoft.Data.SqlClient.SqlConnection.GetOpenTdsConnection() in D:\GitHub\dotnet\SqlClient\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlConnection.cs:line 1928
at Microsoft.Data.SqlClient.SqlConnection.get_ServerProcessId() in D:\GitHub\dotnet\SqlClient\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlConnection.cs:line 762
at Microsoft.Data.SqlClient.SqlCommand.EndExecuteReaderAsync(IAsyncResult asyncResult) in D:\GitHub\dotnet\SqlClient\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlCommand.cs:line 2003
at Microsoft.Data.SqlClient.SqlCommand.EndExecuteReaderAsyncCallback(IAsyncResult asyncResult) in D:\GitHub\dotnet\SqlClient\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlCommand.cs:line 2103

@lbargery
Copy link

@cheenamalhotra Thanks for the above.
We can discuss later (think we have a call), but I think the problem from our side is not that the library needs to retry for us but that the outer retry in Ef core also fails. It seems like Ef core continues to use the same broken connection so then the only way to "retry" is basically to have client logic which calls the same method again which seems a little odd. Would you expect this to be the case?

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Mar 17, 2021

I would say an exception of Class 20 is fatal and should not be retried upon.

Ref https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlexception?view=dotnet-plat-ext-5.0

I also found this section in remarks:

"When the severity level is 20 or greater, the server ordinarily closes the SqlConnection. However, the user can reopen the connection and continue. In both cases, a SqlException is generated by the method executing the command."

The issue we are looking at is that reopening connection fails and SqlConnection stays corrupted for further activity unless you dispose it too.

Cc @roji @ajcvickers

@ErikEJ
Copy link
Contributor

ErikEJ commented Mar 17, 2021

@lbargery Could you share an actual stack trace that involves EF Core please.

@lbargery
Copy link

@ErikEJ This is the stack trace we get

System.InvalidOperationException: The connection does not support MultipleActiveResultSets.
   at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__188_0(Task`1 result)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
   at accuRx.Web.Persistence.Context.ExtendedSqlServerRetryingStrategy.<>c__DisplayClass5_0`2.<<_WithContextAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/src/Web/accuRx.Web.Persistence/Context/ExtendedSqlServerRetryingStrategy.cs:line 48
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementationAsync[TState,TResult](Func`4 operation, Func`4 verifySucceeded, TState state, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementationAsync[TState,TResult](Func`4 operation, Func`4 verifySucceeded, TState state, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()

Worth saying the ExtendedSqlServerRetryingStrategy.cs is just us wrapping the default retry strategy and adding some properties to our logger. We now have the dipose code I posted above in this which handles the MARs error

@roji
Copy link
Member

roji commented Mar 18, 2021

Here are some thoughts from an EF perspective... Hopefully I've understood all of the above.

In regular coding patterns, EF Core closes and opens connections for every operation; this means that with a single DbContext instance, if two queries (or SaveChanges) are executed, DbConnection.OpenAsync is before each query, and DbConnection.CloseAsync is called right after each query. In contrast, when the user explicitly opens the connection via e.g. context.Database.OpenConnectionAsync, the DbConnection stays open until explicitly closed, including when multiple operations are performed.

This means that in typical scenarios, a typical retrying execution strategy will attempt to retry the entire operation multiple times - and that includes closing and opening the connection. This means that as long as the underlying ADO.NET provider handles DbConnection.Close well, the DbConnection.Open from the next retry should succeed. Importantly, this also means that in the EF sense, an exception can be considered transient even if it dooms the current connection - just as long as closing, re-opening and retrying the operation could succeed (this is wider definition of transience compared to being able to retry the operation without closing/re-opening).

To summarize, it seems to me that SqlClient should support closing and re-opening the DbConnection after this exception (or any other), without needing to Dispose; this is also how I'm reading the text in the docs linked to above by @cheenamalhotra:

The SqlConnection remains open when the severity level is 19 or less. When the severity level is 20 or greater, the server ordinarily closes the SqlConnection. However, the user can reopen the connection and continue. In both cases, a SqlException is generated by the method executing the command.

After all, SqlConnection is merely a wrapper/façade over a physical connection - which itself may be doomed - but a close/re-open should get a new physical connection from the pool etc.

Does that make sense?

@cheenamalhotra
Copy link
Member

Thanks @roji for the explanation.

Yes the issue is in SqlClient and we're looking into it. As you mentioned, EF Core's retry strategy is not retrying on previously opened connection, that confirms there is no issue from EF Core layer, and as per documentation SqlClient should be able to recover and re-open without the need to dispose.

@roji
Copy link
Member

roji commented Mar 18, 2021

OK, good that I fully understood :)

But this does raise an interesting question on the EF Core side - if the scenario uses a connection which has been manually opened by the user, the execution retrying strategy will not close/re-open the connection, and so exceptions which doom the connection would not be retriable. Opened dotnet/efcore#24432 to think about this.

@madelson
Copy link
Contributor

As another data point for the impact of fixing this, I think this is the root cause of this issue: madelson/DistributedLock#83

@cheenamalhotra
Copy link
Member

Closing as #1128 has been merged. Fix will be available in the next preview release.

@nickljones
Copy link
Author

Thank you @cheenamalhotra

@eolamisan
Copy link

eolamisan commented Feb 1, 2022

Looks like issue or very similar also may exists for .Net Framework 4.8 and EF 6.4.
What would be the workaround here?

System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.InvalidOperationException: The connection does not support MultipleActiveResultSets. at System.Data.SqlClient.SqlCommand.<>c.b__180_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.d__26.MoveNext() --- End of inner exception stack trace --- at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.d__26.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.d__101.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter1.GetResult() at System.Data.Entity.Core.Objects.ObjectContext.d__1561.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter1.GetResult() at System.Data.Entity.Infrastructure.DbExecutionStrategy.d__211.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter1.GetResult() at System.Data.Entity.Core.Objects.ObjectQuery1.<GetResultsAsync>d__43.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Utilities.TaskExtensions.CultureAwaiter1.GetResult() at System.Data.Entity.Internal.LazyAsyncEnumerator1.<FirstMoveNextAsync>d__9.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions.<ForEachAsync>d__21.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions.d__16`3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at

@Wraith2
Copy link
Contributor

Wraith2 commented Feb 1, 2022

This was closed so I'd suggest making sure you have an up to date version of the library as the first step.

@eolamisan
Copy link

@Wraith2
Sorry, if I'm not mistaken, is System.Data.SqlClient not part of .Net Framework 4.8?
Can I just use the latest from NuGet instead?
https://www.nuget.org/packages/System.Data.SqlClient/4.8.3

@Wraith2
Copy link
Contributor

Wraith2 commented Feb 1, 2022

The System version is only updated with security and high priority patches and those are through windows update. This repo is for the Microsoft.Data.SqlClient library which EFCore uses, not sure about desktop framework EF 6.

@roji
Copy link
Member

roji commented Feb 1, 2022

We do plan to make it possible to use EF 6 (non-Core) with Microsoft.Data.Sqlclient - but that's happening in the coming year, and isn't possible at the moment.

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 2, 2022

@Wraith2 @roji actually possible!

https://www.nuget.org/packages/ErikEJ.EntityFramework.SqlServer/

FyI @eolamisan

@roji
Copy link
Member

roji commented Feb 2, 2022

Oh great @ErikEJ, now I know to point to it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants