none
SQL exception issue

    Question

  • I am seeing a random SQL exception that I cannot identify occurring during a stress test of one of our applications.  The exception is a SQL Error 3617, and appears (based on the exception call stack) to be on the connection open.  The error is random as to when it happens, and it does not happen all the time.  Some tests run to completion without the error showing up, other times it will start happening within the first 2-3 minutes of the stress test.

     

    Environment Information:

     

    Running VS2008 Team Tester Edition SP1 on database server.

    This is a SQL Server 2008 Standard Edition install containing only the apps database.  No other applications run on this server.

     

    The application is accessing the database using the Microsoft Data Access Block version 2.  The command that is failing is a call to SqlHelper.ExecuteReader, getting a data reader from a stored procedure.  The stored procedure is a CLR procedure in SQL.  The connection is closed at the time the command is called, the command should open the connection and then call the stored procedure.  The entire database access code is wrapped in a C# using statement on the ExecuteReader, so even if the prior call to it had failed, the connections would have been closed.

    If anyone can offer some insight or direct me to another forum if necessary. Thanks in advance.
    • Moved by Bob Beauchemin Thursday, February 25, 2010 4:29 AM Moved to a more appropriate group (From:.NET Framework inside SQL Server)
    Tuesday, February 23, 2010 11:39 PM

All replies

  • Please post the complete exception name, error message, and stack trace.  Thanks!
    Thursday, February 25, 2010 11:32 PM
  • From the error page in ASP.NET:

     

    [SqlException (0x80131904): SqlError number (3617) Class (25) ]

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

       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875

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

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

       System.Data.SqlClient.SqlDataReader.CloseInternal(Boolean closeReader) +169

       System.Data.SqlClient.SqlDataReader.Close() +96

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

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

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

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

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

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

       CustomDAL.dalPatients.Patients_Fetch(Int32 userID, UserType userType, Int32 groupID, Boolean inactiveOnly, String whereClause, String sortClause, Int32 startItemIndex, Int32 pageSize) in C:\Projects\2010\Dev2 Client Projects\CustomDAL\dalPatients.cs:1358

       UserControls_Patient_ucPatients.GetData() in c:\Projects\2010\Dev2 Client Projects\Source\UserControls\Patient\ucPatients.ascx.cs:249

       UserControls_Patient_ucPatients.Page_PreRender(Object sender, EventArgs e) in c:\Projects\2010\Dev2 Client Projects\Source\UserControls\Patient\ucPatients.ascx.cs:203

       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14

       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35

       System.Web.UI.Control.OnPreRender(EventArgs e) +8682870

       System.Web.UI.Control.PreRenderRecursiveInternal() +80

       System.Web.UI.Control.PreRenderRecursiveInternal() +171

       System.Web.UI.Control.PreRenderRecursiveInternal() +171

       System.Web.UI.Control.PreRenderRecursiveInternal() +171

       System.Web.UI.Control.PreRenderRecursiveInternal() +171

       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

     

    From the Event Log:

     

    Event Type: Warning

    Event Source:     ASP.NET 2.0.50727.0

    Event Category:   Web Event

    Event ID:   1309

    Date:       3/1/2010

    Time:       9:21:27 AM

    User:       N/A

    Computer:   EF-BB-ABCD

    Description:

    Event code: 3005

    Event message: An unhandled exception has occurred.

    Event time: 3/1/2010 9:21:27 AM

    Event time (UTC): 3/1/2010 2:21:27 PM

    Event ID: e419a3c910a84916ba8dae5a47b82158 Event sequence: 13528 Event occurrence: 42 Event detail code: 0

     

    Application information:

        Application domain: 66327104-3-129119247060493642

        Trust level: Full

        Application Virtual Path: /Source

        Application Path: C:\Projects\2010\Source\

        Machine name: EF-BB-ABCD

     

    Process information:

        Process ID: 2492

        Process name: WebDev.WebServer20.exe

        Account name: DOMAIN\username

     

    Exception information:

        Exception type: SqlException

        Exception message:  

     

    Request information:

        Request URL: http://localhost:3240/Source/Search.aspx

        Request path: /Source/Search.aspx

        User host address: 127.0.0.1

        User: DOMAIN\username

        Is authenticated: True

        Authentication Type: Forms

        Thread account name: DOMAIN\username

     

    Thread information:

        Thread ID: 20

        Thread account name: DOMAIN\username

        Is impersonating: False

        Stack trace:    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

       at System.Data.SqlClient.SqlDataReader.CloseInternal(Boolean closeReader)

       at System.Data.SqlClient.SqlDataReader.Close()

       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 CustomDAL.dalPatients.Patients_Fetch(Int32 userID, UserType userType, Int32 groupID, Boolean inactiveOnly, String whereClause, String sortClause, Int32 startItemIndex, Int32 pageSize) in C:\Projects\2010\Dev2 Client Projects\CustomDAL\dalPatients.cs:line 1358

       at UserControls_Patient_ucPatients.GetData() in c:\Projects\2010\Dev2 Client Projects\Source\UserControls\Patient\ucPatients.ascx.cs:line 249

       at UserControls_Patient_ucPatients.Page_PreRender(Object sender, EventArgs e) in c:\Projects\2010\Dev2 Client Projects\Source\UserControls\Patient\ucPatients.ascx.cs:line 203

       at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)

       at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)

       at System.Web.UI.Control.OnPreRender(EventArgs e)

       at System.Web.UI.Control.PreRenderRecursiveInternal()

       at System.Web.UI.Control.PreRenderRecursiveInternal()

       at System.Web.UI.Control.PreRenderRecursiveInternal()

       at System.Web.UI.Control.PreRenderRecursiveInternal()

       at System.Web.UI.Control.PreRenderRecursiveInternal()

       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

     

    Tuesday, March 09, 2010 1:09 PM
  • Hey TheWheel,

    Were you ever able to resolve this issue?

    Regards,

    Tom

    Monday, September 27, 2010 4:31 PM
  • Error code 3617 is a system attention.   A system attention occurs when the client cancels a running request.  This can happen if the command times out for example.  This error is normally not sent to the client however.

    There is a special case where this can occur that you may be hitting.  When you re-use a pooled connection, the first outbound request sends a special bit flag on the request to tell the server to reset the connection state prior to executing the request.  This bit causes the server to first clear connection state, then execute the command.  If your SQL Server is under heavy load, and this bit is set, and it takes a long time to reset the connection state, the client may timeout and send the system attention.  This causes the reset of the connection to be cancelled and in this case you can see the 3617 sent to the client.

    We've recently hardened this code in current release to avoid sending back this specific error code as the error is spurious in nature (based on timing you may or may not get this error).  In any case, you can consider this error equivalent to: "A severe error occurred on the current command.  The results, if any, should be discarded.  Operation cancelled by user."

    To verify if it is this issue, examine your SQL errorlog for error like below:

    spid51 Task abort was requested while attempting to reuse a session with SPID 51, which has been reset for connection pooling. The session will be terminated.

    • Proposed as answer by William Assaf Thursday, July 05, 2012 9:01 PM
    Monday, September 27, 2010 6:31 PM
    Moderator