title: Reason for System.Transactions.TransactionInDoubtException
body: <p>I have 2 Jobs that read and produce data in a Sql Server Database. Every once in a while the jobs crash with a System.Transactions.TransactionInDoubtException. The exact stack trace is:</p>
  
  <pre><code> Unhandled Exception: System.Transactions.TransactionInDoubtException: The transaction is in doubt. ---&gt; System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. ---&gt; System.ComponentModel.Win32Exception: The wait operation timed out. Exitcode: -532462766
      --- End of inner exception stack trace ---
      at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
      at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
      at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
      at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
      at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()
      at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
      at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean&amp; dataReady)
      at System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte&amp; value)
      at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
  </code></pre>
  
  <p>I googled a bit about it and found something about MSDTC, but I think this can't be the problem because the Transaction should be local since the jobs only work on a single database. The following query: </p>
  
  <pre><code>SELECT cntr_value AS NumOfDeadLocks
    FROM sys.dm_os_performance_counters
   WHERE object_name = 'SQLServer:Locks'
     AND counter_name = 'Number of Deadlocks/sec'
     AND instance_name = '_Total'
  </code></pre>
  
  <p>shows that there have been no deadlocks on the database, so deadlocks can't be the reason. I couldn't find any other resource on the internet which gives exact information about the reason of the exception. So has anybody a idea what the reason could be or how to find the root of this error?</p>