none
Wierd System.Data.SqlClient.SqlException: Timeout expired-Issue RRS feed

  • Question

  • Dear all,

    We have a WPF client application which post regulary some request to WCF services hosted under IIS7 running on Windows Server 2008 and SQL Server 2005 database.

    We have the time out error occuring time to time and we do not know where to react to solve that issue. The expection trace is as follow :

    Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.(stackTrace:   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
       at System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
       at System.Data.SqlClient.TdsParserStateObject.ReadBuffer()
       at System.Data.SqlClient.TdsParserStateObject.ReadByte()
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
       at System.Data.SqlClient.SqlDataReader.get_MetaData()
       at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
       at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
       at Maillefer.Nomos.Plateform.RecipeSys.SqlClient.Recipe.GetRunningModifiedRecipeParameters(String ConnectionString)
       at Maillefer.Nomos.Plateform.RecipeSys.SqlClient.Recipe.UpdateRuntimeTagnameValue(String ConnectionString, String xmlDoc, String Source)
       at Maillefer.Nomos.Plateform.RecipeSys.Recipe.TagNameParamListCallBack(Object stateinfo))(Inner:)
    

    Any idea to point me out how to track and isolate this issue and what to do ?

    Please note that our WCF service hosted under IIS are manage by the same pool which have its recycling option desable.

    Thanks for help

    regards

    serge


    Your knowledge is enhanced by that of others.

    Tuesday, September 3, 2013 9:41 AM

Answers

  • Hello,

    Thank you for posting your question to this forum.

    From your description, it throws a sql exception when the program runs.

    If I have misunderstood, please let me know.

    I notice that the exception message “at System.Data.SqlClient.SqlDataReader.get_MetaData()”.

    So I guess the connection is ok and the problem may be caused by CommandTimeout property.

    As far as I know, in the .NET code the CommandTimeout property on the SqlCommand object is used to make the database call. The default is 30 (seconds). A value of 0 indications no limit, and should be avoided in a CommandTimeout because an attempt to execute a command will wait indefinitely.

    So we can set it a bigger number like 180 to let the command have enough time to be executed.

    And we can use the SET STATISTICS statements to see how the database is used form the command.

    There is a link showing how to use it below:

    http://msdn.microsoft.com/en-us/library/ms184361(v=sql.90).aspx

    Best Regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, September 4, 2013 2:28 AM
    Moderator