Search code examples
c#.netsql-serversql-server-2005

The transaction has aborted


I have a multithreaded C# application where each thread has it's own set of db connections. Each thread uses TransactionScope / DTC. Sometimes, I get a "The transaction has aborted" exception. It's not from a timeout since it occurs in less than 2 seconds from starting the transaction.

Here's the stacktrace:

at System.Transactions.TransactionStateAborted.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState) at System.Transactions.CommittableTransaction.Commit() at System.Transactions.TransactionScope.InternalDispose() at System.Transactions.TransactionScope.Dispose() at MyNamespace.CallingMethod()

It happenes very infrequently, say once in 100,000 transactions.

Environment: Windows Server 2003 .Net 2.0 Connects to SqlServer 2005

Any ideas on why this is occuring? Thanks!


Solution

  • I think this is attributed to network instability. It is very infrequent, and hasn't reared it's ugly head in quite a few months now.