Missing Commit
Maybe this is obvious to everyone, but it took me a while to figure out.
I am experimenting with a durable resource manager that is supposed to live inside an assembly that is loaded into the client application program process. I have noticed that sometimes the Commit() method is never called or at least interrupted before the application ends. The application code uses TransactionScope. I realize that this is a distributed transaction and that the application process completes before MSDTC is finished executing the Commit() method. The ComponentServices mmc reports these transactions as active with status "only failed to notify".
I guess the solution must be to always keep a durable resource manager in its own always-running process.
Kinda sad because it all seemed so simple...
[825 byte] By [
AndersW] at [2008-2-4]
AndersW,
The Resource Manager must indeed be available to receive the Commit notification. However, a Durable Resource Manager doesn't need to be "always-running." In fact, a Durable Resource Manager must support recovery for the cases in which it is In-Doubt about the outcome of a Transaction (it has replied to the Prepare, but not yet received Commit or Abort) and it goes down. When the Resource Manager comes back up it must read its log and Reenlist on all the In-Doubt Transactions it had. Each "failed to notify" Transaction you see in the msdtc Transaction statistics should correspond to an In-Doubt transaction that your Resource Manager that enlisted durably did not receive the Commit for and reply to. After Reenlist, the Commit will be delivered by msdtc. Once all Transactions have been recovered the Resource Manager should call RecoveryComplete to notify to msdtc that it is finished with its recovery processing.
Miguel