C# WCF service randomly crashing while loading data from SQL Server

  • Thread starter Thread starter Alberto20
  • Start date Start date
A

Alberto20

Guest
I have a .Net framework 4.7 WCF service which works fine in the development environment and in most of our clients’ production environments except for one client. The service randomly crashes on one of our clients’ server.

The service handles requests from several client applications and some of the requests includes executing some complex SQL queries and loading data from the database.

I used the ProcDump on the clients’ production environment to generate the crash dumps and I got the following information from the crash dumps


Exception Analysis

MethodDesc: 00007ffc0217f420
Method Name: SNINativeMethodWrapper.SNIPacketAllocate(System.Runtime.InteropServices.SafeHandle, IOType, IntPtr ByRef)
Class: 00007ffc02168978
MethodTable: 00007ffc0217f570
mdToken: 000000000600006e
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc04facda0
Transparency: Safe critical
MethodDesc: 00007ffc021f0f10
Method Name: System.Data.SqlClient.SNIPacket..ctor(System.Runtime.InteropServices.SafeHandle)
Class: 00007ffc021d5358
MethodTable: 00007ffc021f0f30
mdToken: 000000000600224f
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc04faccc0
Transparency: Safe critical
MethodDesc: 00007ffc021f1e88
Method Name: System.Data.SqlClient.TdsParserStateObject.SendAttention(Boolean)
Class: 00007ffc021d5548
MethodTable: 00007ffc021f2160
mdToken: 00000000060022bc
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc05795b10
Transparency: Safe critical
MethodDesc: 00007ffc021f1d98
Method Name: System.Data.SqlClient.TdsParserStateObject.ReadSniError(System.Data.SqlClient.TdsParserStateObject, UInt32)
Class: 00007ffc021d5548
MethodTable: 00007ffc021f2160
mdToken: 00000000060022ad
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc07dc6b00
Transparency: Safe critical
MethodDesc: 00007ffc021f1d38
Method Name: System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
Class: 00007ffc021d5548
MethodTable: 00007ffc021f2160
mdToken: 00000000060022a7
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc04faeaf0
Transparency: Safe critical
MethodDesc: 00007ffc021f1d18
Method Name: System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
Class: 00007ffc021d5548
MethodTable: 00007ffc021f2160
mdToken: 00000000060022a5
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc04fae9f0
Transparency: Safe critical
MethodDesc: 00007ffc021f1b88
Method Name: System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()
Class: 00007ffc021d5548
MethodTable: 00007ffc021f2160
mdToken: 000000000600228c
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc04fb38b0
Transparency: Safe critical
MethodDesc: 00007ffc021f1be8
Method Name: System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte ByRef)
Class: 00007ffc021d5548
MethodTable: 00007ffc021f2160
mdToken: 0000000006002292
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc04fb3820
Transparency: Safe critical
MethodDesc: 00007ffc021ed6c8
Method Name: System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior, System.Data.SqlClient.SqlCommand, System.Data.SqlClient.SqlDataReader, System.Data.SqlClient.BulkCopySimpleResultSet, System.Data.SqlClient.TdsParserStateObject, Boolean ByRef)
Class: 00007ffc021d3f08
MethodTable: 00007ffc021ee3c8
mdToken: 0000000006002147
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc04fb2660
Transparency: Safe critical
MethodDesc: 00007ffc021cf7a0
Method Name: System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean ByRef)
Class: 00007ffc021d0190
MethodTable: 00007ffc021e0068
mdToken: 0000000006001c31
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc05009b10
Transparency: Safe critical
MethodDesc: 00007ffc021cf7f8
Method Name: System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean, Boolean ByRef)
Class: 00007ffc021d0190
MethodTable: 00007ffc021e0068
mdToken: 0000000006001c38
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc050095b0
Transparency: Safe critical
MethodDesc: 00007ffc021cf7f0
Method Name: System.Data.SqlClient.SqlDataReader.Read()
Class: 00007ffc021d0190
MethodTable: 00007ffc021e0068
mdToken: 0000000006001c37
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc05009330
Transparency: Safe critical
MethodDesc: 00007ffc021cddd8
Method Name: System.Data.Common.DataAdapter.FillLoadDataRow(System.Data.ProviderBase.SchemaMapping)
Class: 00007ffc021afb48
MethodTable: 00007ffc021cdec0
mdToken: 0000000006002d0e
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc050dafd0
Transparency: Safe critical
MethodDesc: 00007ffc021cddb8
Method Name: System.Data.Common.DataAdapter.FillFromReader(System.Data.DataSet, System.Data.DataTable, System.String, System.Data.ProviderBase.DataReaderContainer, Int32, Int32, System.Data.DataColumn, System.Object)
Class: 00007ffc021afb48
MethodTable: 00007ffc021cdec0
mdToken: 0000000006002d0c
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc050d83e0
Transparency: Safe critical
MethodDesc: 00007ffc021cddb0
Method Name: System.Data.Common.DataAdapter.Fill(System.Data.DataTable[], System.Data.IDataReader, Int32, Int32)
Class: 00007ffc021afb48
MethodTable: 00007ffc021cdec0
mdToken: 0000000006002d0b
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc050d7b70
Transparency: Safe critical
MethodDesc: 00007ffc021ce4e0
Method Name: System.Data.Common.DbDataAdapter.FillInternal(System.Data.DataSet, System.Data.DataTable[], Int32, Int32, System.String, System.Data.IDbCommand, System.Data.CommandBehavior)
Class: 00007ffc021afce0
MethodTable: 00007ffc021ce6e8
mdToken: 0000000006002f80
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc050d7200
Transparency: Safe critical
MethodDesc: 00007ffc021ce4d8
Method Name: System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable[], Int32, Int32, System.Data.IDbCommand, System.Data.CommandBehavior)
Class: 00007ffc021afce0
MethodTable: 00007ffc021ce6e8
mdToken: 0000000006002f7f
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc050d6e30
Transparency: Safe critical
MethodDesc: 00007ffc021ce4b0
Method Name: System.Data.Common.DbDataAdapter.Fill(System.Data.DataTable)
Class: 00007ffc021afce0
MethodTable: 00007ffc021ce6e8
mdToken: 0000000006002f7c
Module: 00007ffbfff78fe0
IsJitted: yes
CodeAddr: 00007ffc050d69e0
Transparency: Safe critical

I use the method below to load data from the database and it seems as if the crash always happens in the DataAdapter.Fill


private DataTable LoadDataTable(string Command, int? TimeoutOverride)
{
var dt = new DataTable();
try
{
using (m_ActiveCommand = new SqlCommand(Command, Connection as SqlConnection))
{
using (var ad = new SqlDataAdapter(m_ActiveCommand))
{
ad.SelectCommand.CommandTimeout = TimeoutOverride ?? Timeout;
ad.Fill(dt);
}
}
}
catch (Exception ex)
{
LogHelper.WriteToLog(ex);
return null;
}
return dt;
}

Continue reading...
 
Back
Top