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!
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.
You can create a memory dump, the instruction can be found here http://blogs.msdn.com/b/joncole/archive/2007/03/29/creating-a-process-memory-dump.aspx
Then you can check with windbg to reveal what's root exception caused this issue. There are lots of useful information about how to use windbg check the managed exception.
in the mean time , you can use sql profiler to monitor if any sql error happened around the time when the exception was thrown.
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.
If any of you facing this issue, please be noted that I managed to find the solution and the issue.. In the app config file, a properties for the connection string missing which was the "Enlist",.
Earlier the connection string was = <add name="HIS_Test_12" connectionString="server=OXYGEN\SQL2008ENT;database=CHIS_VN_12;UID=sa;Password=1234;Max Pool Size=100;Connect Timeout=200;" providerName="System.Data.SqlClient" />
Now the updated connection string is = <add name="HIS_Test_12" connectionString="server=OXYGEN\SQL2008ENT;database=CHIS_VN_12;UID=sa;Password=1234;Max Pool Size=100;Connect Timeout=200;Enlist=False;" providerName="System.Data.SqlClient" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With