SqlDataReader hangs on GetValue() method and SNIReadSyncOverAsync

寵の児 提交于 2019-12-02 11:34:16

问题


We have an extremely weird problem at hand. The .Net SqlDataReader object gets stuck while reading a value on GetValue() method. There are no exceptions and it does not timeout for at least more than 10 minutes which is really long time. After more than 10 minutes, it throws this error:

General Exception - !ET:SqlException{CRLF}!M:Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.{CRLF}General Exception - !ET:Win32Exception{CRLF}!M:The wait operation timed out{CRLF}!

Stack trace obtained through process dump.

000000001b2ee6f8 0000000076eabe7a [InlinedCallFrame: 000000001b2ee6f8] .SNIReadSyncOverAsync(SNI_ConnWrapper*, SNI_Packet**, Int32) 000000001b2ee6f8 000007fef35a3ab1 [InlinedCallFrame: 000000001b2ee6f8] .SNIReadSyncOverAsync(SNI_ConnWrapper*, SNI_Packet**, Int32) 000000001b2ee6d0 000007fef35a3ab1 DomainBoundILStubClass.IL_STUB_PInvoke(SNI_ConnWrapper*, SNI_Packet**, Int32) 000000001b2ee7a0 000007fef358a35f SNINativeMethodWrapper.SNIReadSyncOverAsync(System.Runtime.InteropServices.SafeHandle, IntPtr ByRef, Int32) 000000001b2ee810 000007fef358a07e System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() 000000001b2ee8c0 000007fef3589f90 System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket() 000000001b2ee900 000007fef358a760 System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer() 000000001b2ee930 000007fef358d8cb System.Data.SqlClient.TdsParser.TryGetTokenLength(Byte, System.Data.SqlClient.TdsParserStateObject, Int32 ByRef) 000000001b2ee980 000007fef359de78 System.Data.SqlClient.TdsParser.TryGetDataLength(System.Data.SqlClient.SqlMetaDataPriv, System.Data.SqlClient.TdsParserStateObject, UInt64 ByRef) 000000001b2ee9c0 000007fef359dce3 System.Data.SqlClient.TdsParser.TryProcessColumnHeaderNoNBC(System.Data.SqlClient.SqlMetaDataPriv, System.Data.SqlClient.TdsParserStateObject, Boolean ByRef, UInt64 ByRef) 000000001b2eea40 000007fef359da4c System.Data.SqlClient.SqlDataReader.TryReadColumnInternal(Int32, Boolean) 000000001b2eeae0 000007fef359d900 System.Data.SqlClient.SqlDataReader.TryReadColumn(Int32, Boolean, Boolean) 000000001b2eeb50 000007fef359d81b System.Data.SqlClient.SqlDataReader.GetValueInternal(Int32) 000000001b2eeb90 000007fef359d7c7 System.Data.SqlClient.SqlDataReader.GetValue(Int32)

This is surely not a database locking problem because what we observed is it gets past ExecuteReader() method. We can also see in SQL profiler that original command has completed successfully. It is only while iterating through records and reading values that it gets stuck. This happens randomly every 10-15 days.

Has someone faced issue like this before? What could be the reason?

I already stackoverflow thread but it did not offer solution. Could it be a network connectivity issue? Why does it not timeout?

来源:https://stackoverflow.com/questions/42016075/sqldatareader-hangs-on-getvalue-method-and-snireadsyncoverasync

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!