Killing a process while in a TransactionScope

  • Thread starter gareththackeray
  • Start date
G

gareththackeray

Hi,

We've been using the TransactionScope class which is great and really
makes using Transactions a doddle. However, if we kill the process in
the middle of a using(TransactionScope) block, it leaves it hanging,
seemingly indefinitely, until we restart the DTC on either client or
server.

So, I have two questions:

1. are there any techniques to force the transaction to rollback on
killing the process;

2. which of the many available timeouts controls the transaction
timeout on the DTC?

Thanks in advance,

Gareth
 
L

Laura T.

What you mean by "killing", TerminateProcess() API?
If so, there is nothing you can do about it. TerminateProcess() "freezes"
the target process immediatly. No more user mode code will run on it. No
cleanup. Nothing.

This works for me. Never seen pending transactions around for more than 35
seconds.
using (TransactionScope innerTrx = new
TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(30)))
{
}

It is possible to set a global timeout for MSDTC (old doc but actual):

http://support.microsoft.com/?scid=kb;en-us;287499&x=12&y=13
 
G

gareththackeray

Thanks Laura. We're seeing timeouts on transactions taking more than
20s though, which seems strange as we can't find any timeout set to
20s! We'll keep looking... In truth our database needs some tuning
so we should be able to reach the point of not getting 20s
transactions anyway.

Cheers,

Gareth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top