System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired with Error Number:-2

0

I have a C# .NET 4.7.2 application that connects to SQL Server 2014. One of the stored procedures called from the application runs into following error:

xyzStoredProcedure: Exception encountered. System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Application.SomeMethod()
ClientConnectionId: {f0b2bed5-8baf-444a-b969-500ac2ca3aad}
Error Number:-2,State:0,Class:11

I understand Execution Timeout Expired means the application was able to establish a connection with the database and the database started running the stored procedure but the stored procedure ran longer than the timeout value set in the application, so the application gave up on the stored procedure.

However, MSDN describes the Error Number:-2, shown at the end of the exception stack, as shown in the image.

enter image description here The Message Text, Explanation from the image and the Execution Timeout Expired from the exception stack don't seem to agree with each other.

Questions:

  1. Is the MSDN incorrect?

  2. Can someone explain what could cause Execution Timeout Expired with Error Number: -2? The other stored procedures from the same application process, same connection string, same database and around the same time of this error work all fine.

  3. What do State and Class Number represent in the exception stack?

c#
.net
sql-server
sqlclient
asked on Stack Overflow May 16, 2019 by HappyTown

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0