C# – The transaction has aborted

cnetsql serversql-server-2005

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!

Best Answer

Is this call stack from your inner-most InnerException? I you get this exceptions, there is usually (not always, though) an InnerException with more info.

My bet would be on a database deadlock.