Skip to content

crash caused by an exception throw in SNIMarsHandle::Dispose() #31491

Description

@oldzhu

we saw several crash caused by an exception throw in SNIMarsHandle::Dispose() in .net core 2.2 release as the below:

(lldb) pe 00007F27B92B7920
Exception object: 00007f27b92b7920
Exception type: System.Net.Sockets.SocketException
Message: Broken pipe
InnerException:
StackTrace (generated):
SP IP Function
00007F2786FFC190 00007F27DFF30C7B System.Net.Sockets.dll!System.Net.Sockets.NetworkStream.Write(Byte[], Int32, Int32)+0xcb

StackTraceString:
HResult: 80004005
There are nested exceptions on this thread. Run with -nested for details
(lldb) clrstack
OS Thread Id: 0x1cf3f (18)
Child SP IP Call Site
00007F2786FFAE98 00007f2858aa0b5a [HelperMethodFrame: 00007f2786ffae98]
00007F2786FFAFE0 00007F27E1C5D9A6 System.Data.SqlClient.SNI.SNIMarsHandle.Dispose() [//src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsHandle.cs @ 49]
00007F2786FFC1D0 00007f2857325a57 [HelperMethodFrame: 00007f2786ffc1d0]
00007F2786FFC350 00007F27DE01A9E3 System.Threading.Tasks.Task.Wait(Int32, System.Threading.CancellationToken) [/root/coreclr/src/mscorlib/src/System/Threading/Tasks/Task.cs @ 2788]
00007F2786FFC380 00007F27E1C440F2 System.Data.SqlClient.SNI.SslOverTdsStream.Write(Byte[], Int32, Int32)
00007F2786FFC3A0 00007F27DE8F8077 System.Net.Security.SslStreamInternal.WriteSingleChunk[[System.Net.Security.SslStreamInternal+SslWriteSync, System.Net.Security]](SslWriteSync, System.ReadOnlyMemory1<Byte>) [/root/corefx-2599009/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.cs @ 415] 00007F2786FFC490 00007F27DE8F70BE System.Net.Security.SslStreamInternal.WriteAsyncInternal[[System.Net.Security.SslStreamInternal+SslWriteSync, System.Net.Security]](SslWriteSync, System.ReadOnlyMemory1) [/root/corefx-2599009/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.cs @ 343]
00007F2786FFC550 00007F27DE8F5EDA System.Net.Security.SslStreamInternal.Write(Byte[], Int32, Int32) [/root/corefx-2599009/src/System.Net.Security/src/System/Net/Security/SslStreamInternal.cs @ 140]
00007F2786FFC5F0 00007F27DE90028C System.Net.Security.SslStream.Write(Byte[], Int32, Int32) [/root/corefx-2599009/src/System.Net.Security/src/System/Net/Security/SslStream.cs @ 701]
00007F2786FFC620 00007F27E1C3D969 System.Data.SqlClient.SNI.SNITCPHandle.Send(System.Data.SqlClient.SNI.SNIPacket) [/
/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNITcpHandle.cs @ 428]
00007F2786FFC660 00007F27E1C5BE31 System.Data.SqlClient.SNI.SNIMarsConnection.Send(System.Data.SqlClient.SNI.SNIPacket) [//src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsConnection.cs @ 83]
00007F2786FFC690 00007F27E1C5BC48 System.Data.SqlClient.SNI.SNIMarsHandle.SendControlPacket(System.Data.SqlClient.SNI.SNISMUXFlags) [/
/src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsHandle.cs @ 88]
00007F2786FFC6E0 00007F27E1C5D978 System.Data.SqlClient.SNI.SNIMarsHandle.Dispose() [//src/System.Data.SqlClient/src/System/Data/SqlClient/SNI/SNIMarsHandle.cs @ 49]
00007F2786FFC700 00007F27E1C5D86D System.Data.SqlClient.SNI.TdsParserStateObjectManaged.Dispose() [/
/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserStateObjectManaged.cs @ 88]
00007F2786FFC720 00007F27E1C5D65E System.Data.SqlClient.TdsParserSessionPool.Dispose() [//src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParserSessionPool.cs @ 85]
00007F2786FFC780 00007F27E1C5C31D System.Data.SqlClient.TdsParser.Disconnect() [/
/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs @ 943]
00007F2786FFC7B0 00007F27E40353B7 System.Data.SqlClient.SqlInternalConnectionTds.Dispose() [//src/System.Data.SqlClient/src/System/Data/SqlClient/SqlInternalConnectionTds.cs @ 599]
00007F2786FFC7D0 00007F27E4035313 System.Data.ProviderBase.DbConnectionPool.DestroyObject(System.Data.ProviderBase.DbConnectionInternal) [/
/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPool.cs @ 912]
00007F2786FFC810 00007F27E40235CF System.Data.ProviderBase.DbConnectionPool.CleanupCallback(System.Object) [/_/src/System.Data.SqlClient/src/System/Data/ProviderBase/DbConnectionPool.cs @ 582]
00007F2786FFC870 00007F27DDC89716 System.Threading.TimerQueueTimer.CallCallback() [/root/coreclr/src/mscorlib/src/System/Threading/Timer.cs @ 610]
00007F2786FFC8B0 00007F27DDC8953E System.Threading.TimerQueueTimer.Fire() [/root/coreclr/src/mscorlib/src/System/Threading/Timer.cs @ 569]
00007F2786FFC900 00007F27DDCABBAB System.Threading.TimerQueue.FireNextTimers() [/root/coreclr/src/mscorlib/src/System/Threading/Timer.cs @ 339]
00007F2786FFCCB0 00007f285733717f [DebuggerU2MCatchHandlerFrame: 00007f2786ffccb0]
(lldb) bt

and also saw throw was removed by the following commit change several days ago:

remove throw in exception handling of dispose (#42457)
dotnet/corefx@790785a

Please port the change back to the .NET core 2.2 to fix the crash...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions