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

  • Question

  • Hi Team,

    I am a production DBA. We are getting the below exception from application(its an asp.net application):

    Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

    Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

    Description:

     

     

     

     

     

    Exception Details:

     

     

     

     

     

    Source Error:

    Stack Trace:

    Version Information:

     

     

     

     

     

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the

    exception can be identified using the exception stack trace below.

    [SqlException (0x80131904): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.]

    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +212

    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +245

    System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +87

    System.Data.SqlClient.SqlDataReader.get_MetaData() +112

    System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +2476580

    System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +2478113

    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +424

    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +28

    System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +211

    System.Data.SqlClient.SqlCommand.ExecuteReader() +117

    System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& [HttpException (0x80004005): Unable to connect to SQL Server session database.]

    System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e) +2984300

    System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& System.Web.SessionState.SqlSessionStateStore.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) System.Web.SessionState.SessionStateModule.GetSessionStateItem() +185

    System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +1042

    System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +85

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +26

    Please recommend me the troubleshooting steps. As far as I know this is related to application end and there should be a setting which needs to be changed from application end, but I am not sure what is the parameter to check from application end. Please advise.

    Thanks in advance!

    Regards,

    Sharath

     

     

     

    Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618
    System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
    An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

     

    • Moved by Bob Beauchemin Thursday, March 10, 2011 10:08 PM Moved to a more appropriate forum (From:.NET Framework inside SQL Server)
    Thursday, March 10, 2011 1:16 PM

Answers

  • In the .NET code you'll want to adjust the CommandTimeout property on the SqlCommand object being used to make the database call. The default is 30 (seconds). Setting it to 0 will allow the command to run indefinitely until the command completes.
    Make everything as simple as possible, but not simpler. --Albert Einstein
    Thursday, March 10, 2011 5:28 PM
  • If CommandTimeout setting does not help, then I would recommend checking query execution plan to see why it takes so much time to execute query. Maybe it is just not optimized indexes on database side or application uses less-than-efficient query. 


    Val Mazur (MVP) http://www.xporttools.net
    Friday, March 11, 2011 2:31 AM
    Moderator
  • Thanks for your help! It is resolved!

    Regards,
    Sharath

    • Marked as answer by skrishnamu008 Tuesday, March 22, 2011 9:07 PM
    Tuesday, March 22, 2011 9:06 PM

All replies

  • In the .NET code you'll want to adjust the CommandTimeout property on the SqlCommand object being used to make the database call. The default is 30 (seconds). Setting it to 0 will allow the command to run indefinitely until the command completes.
    Make everything as simple as possible, but not simpler. --Albert Einstein
    Thursday, March 10, 2011 5:28 PM
  • If CommandTimeout setting does not help, then I would recommend checking query execution plan to see why it takes so much time to execute query. Maybe it is just not optimized indexes on database side or application uses less-than-efficient query. 


    Val Mazur (MVP) http://www.xporttools.net
    Friday, March 11, 2011 2:31 AM
    Moderator
  • Thanks for your suggestions! I will try out and let you know!!
    Monday, March 14, 2011 6:16 AM
  • Hi Sharath,

    I am wirting here to check the status of your issue, have you solved it? If so, please mark the useful reply as answer.

    If not, could you please show us? We will be happy to follow up this until it is solved.

     

    Have a nice day,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, March 16, 2011 5:20 AM
    Moderator
  • Thanks for your help! It is resolved!

    Regards,
    Sharath

    • Marked as answer by skrishnamu008 Tuesday, March 22, 2011 9:07 PM
    Tuesday, March 22, 2011 9:06 PM
  • Hi Krishna,

     

    I am a production DBA. I am facing the same issue that what you have faced an mentioned here.

    Please let me know what you have done to resolve this issue.

    Saturday, October 22, 2011 9:39 AM
  • Hi ALL,

     

    I am facing the same issue. Please help me to solve this issue.

     Description:

    SiteTopicFeed::Load- Timeout expired.  The timeout period elapsed prior to

    completion of the operation or the server is not responding.   at

    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean

    breakConnection)

       at

    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObjec

    t stateObj)

       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.ExecuteReader()

       at Norman.SiteTopicFeed.Load(Int32 siteID)

     

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

     

    • Proposed as answer by VijayKSQL Saturday, October 22, 2011 9:44 AM
    Saturday, October 22, 2011 9:44 AM