What do these MS DTC Exceptions mean?

Posted by David B on Stack Overflow See other posts from Stack Overflow or by David B
Published on 2012-10-30T18:53:00Z Indexed on 2012/11/08 17:00 UTC
Read the original article Hit count: 747

Filed under:
|
|

I wrote a program to demonstrate the behavior of DTC timeouts with multiple threads. I'm getting several exceptions, seemingly at random. Are all of these simple Timeouts, or are some of them indicative of deeper problems (connection pool interactions, etc)?

The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.

Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.

The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements.

The operation is not valid for the state of the transaction.

ExecuteReader requires an open and available Connection. The connection's current state is closed.

Here's the data part of the code:

using (DemoDataDataContext dc1 = new DemoDataDataContext(Conn1))
using (DemoDataDataContext dc2 = new DemoDataDataContext(Conn2))
{
  WriteMany(dc1, 100);  //generate 100 records for insert
  WriteMany(dc2, 100000);  //generate 100,000 records for insert

  Console.WriteLine("{0} : {1}", Name, " generated records for insert.");
  using (TransactionScope ts = new TransactionScope())
  {
    dc1.SubmitChanges();
    dc2.SubmitChanges();
    ts.Complete();
  }
}

© Stack Overflow or respective owner

Related posts about exception

Related posts about transactionscope