DCSIMG
Debugging Distributed Transactions: MSDTC network problems - Ido Flatow's Blog Veni Vidi Scripsi

Ido Flatow's Blog

Veni Vidi Scripsi

News

Have you heard me speak?
Powered
<style type='text/css' media='screen' id='sm_css'> #smix {overflow: visible;height: auto;border-radius: 10px;max-width: 250px;background-color: #323232;text-align: left;font-size: 12px;line-height: 16px;font-family:'Lucida Sans Unicode','Lucida Grande',Verdana,Arial,Helvetica,sans-serif;-webkit-border-radius: 10px;-moz-border-radius: 10px;border-radius: 10px;} #smix a {color: #0056CC;text-decoration: none;} #smix .sm_head {color: #fff; line-height: 1em;font-size: 1.4em;padding: 10px;color: #fff;} #smix .sm_lanyard_wrapper {background-color: #fff;;clear: both;width: 97%;margin: 0 auto;margin-bottom: 0px;} #smix .sm_lanyard_content {padding: 7px;}#smix button.sm_rec, #smix a.sm_rec, #smix input[type=submit].sm_rec { padding: 6px 10px; -webkit-border-radius: 2px 2px;-moz-border-radius: 2px; border-radius: 2px; border: solid 1px rgb(153, 153, 153); background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(255, 255, 255)), to(rgb(221, 221, 221))); color: #333; text-decoration: none; cursor: pointer; display: inline-block; text-align: center; text-shadow: 0px 1px 1px rgba(255,255,255,1); line-height: 1; }#smix .sm_rec:hover { background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(248, 248, 248)), to(rgb(221, 221, 221))); }#smix .sm_rec:active { background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(204, 204, 204)), to(rgb(221, 221, 221))); }#smix .sm_rec.medium { padding: 3px 7px; font-size: 13px; }#smix .sm_rec span.icon.thumbs_up {background-position: 0px 36px;vertical-align: text-top;display: inline-block;margin-right: 4px;height: 18px;width: 16px;background-image: url(http://speakermix.com/images/new/thumbsold.png);}#smix .sm_rec:hover span.icon.thumbs_up {background-position: 0px 18px;} #smix .sm_events {padding:2px 0px 4px 0px;} #smix .sm_section {font-size: 10px; border-bottom: 1px solid silver; margin-bottom: 6px;} #smix .sm_subline {font-size:120%;margin-top:4px;font-weight:bold} #smix .powered {text-align: right} #smix .powered img {margin: 7px} </style>
Sela Technology Center

Advertisement

Debugging Distributed Transactions: MSDTC network problems

It has been a while since I’ve published a post in my blog. In the past couple of months I’ve been working hard on writing the new official WCF 4 course for Microsoft and writing a book about ASP.NET 4 together with Shay Fridman, but things are calming down and I’m getting back to business.

A few days ago Sasha started writing several posts about debugging distributed transactions.

One issue that developers need to be aware of is the need to configure the transaction coordinators in all the machines that are involved in the transaction.

WCF supports both OLE transactions, which uses MSDTC (Microsoft Distributed Transaction Coordinator) and WS-AtomicTransaction which uses SOAP messages to transfer coordination messages.

By default, WCF uses OLE transactions and MSDTC, because usually the transaction scenario is used in intranet scenarios and not in Internet scenarios. If you need to use a distributed transaction over the Internet, you’ll probably want to switch to WS-AtomicTransaction (you’ll need to use a custom binding to do this), because MSDTC uses TCP communication which might be blocked when used in the Internet.

Any way, I’m not here to talk about WCF and distributed transactions, I will leave this to Sasha, I would like to share with you a case I faced today, trying to make the MSDTC service to run properly.

The scenario is as follows – a Windows 7 desktop is running a client application that uses a distributed transaction between an MS SQL server 2005 and Oracle 10g. The application isn’t using WCF, but the story is the same if it had been using WCF.

When the application tried to open a distributed transaction with both databases, the connection to the SQL Server failed with the following reason:

“The MSDTC transaction manager was unable to pull the transaction from the source transaction manager due to communication problems. Possible causes are: a firewall is present and it doesn't have an exception for the MSDTC process, the two machines cannot find each other by their NetBIOS names, or the support for network transactions is not enabled for one of the two transaction managers. (Exception from HRESULT: 0x8004D02B).”

The firewall option was dropped since the servers and the desktop are in a closed network with no firewall, and there is no port blocking (checked with netstat –n), we’ve also removed the transaction security to minimum, but it still didn’t work.

Next step was to enable transaction tracing. Looking at the trace file showed the following error message: “SecureBuildContextWrapper call failed. This is usually due to security/network configuration issues”.

Because security was already checked, we went to check the network. We already saw that there was no firewall problem, so we decided to check if all the coordinators can talk with each other. Pinging from the SQL Server machine to the Oracle machine worked fine (we used the Ping command, but you can also use dtcPing), and vice-versa, and the client was able to ping both machines, but… when pinging from the  SQL Server machine to the client machine, the ping failed !!

A quick check found out the reason – the SQL Server and Oracle machines where in a different domain from the client machine. In our organization, servers are in a different domain than the developers machines, but all the developer’s machines have a DNS suffix settings in their network device, so we won’t need to use the full name of the servers (machine + domain suffix). However, non of the servers had a DNS suffix for the developers domain.

After adding the DNS suffix of the developers domain to the database machines, and validating that they can ping client machines by their names (without the domain suffix), the distributed transaction worked !

So to conclude, what we need to check when troubleshooting MSDTC exceptions is:

  1. Make sure all machines have MSDTC installed and running. Actually this was our first problem with the SQL Server machine, but this is easy to check and fix, so I didn’t mention it before.
  2. Make sure there is no firewall block. Either use netstat –n  or use dtcPing to check blocked ports while you try to establish a transaction.
  3. Make sure all machines support inbound and outbound communication (compare MSDTC settings between machines in control panel->Administrative tools->Component Services).
  4. Make sure all machines can access each other (ping).
  5. If you still can’t get it to work, enable tracing and look at the outputted trace file for any suspicious errors (don’t forget to remove the tracing settings, so it won’t affect performance).

I hope we won’t get to too many problems further down the road, but if we will and we’ll find how to solve them (hopefully), I’ll be sure to let you know.

Comments

archmisha said:

Awesome post.

Right to the point, fixing our bugs

:P

# July 28, 2010 5:21 PM

Sailee said:

Awesome post

# November 3, 2010 12:31 PM

Mark said:

Good summary. In my case I had to reconfig MSDTC settings and add DNS suffix

# January 21, 2011 9:38 PM

Tai said:

Thanks for your document. I have fixed my serious problem. Thank you so much.

# March 24, 2011 10:55 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: