Home All Groups Group Topic Archive Search About

Killing a process while in a TransactionScope

Author
3 Apr 2007 2:26 PM
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

Author
3 Apr 2007 3:29 PM
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%3Ben-us%3B287499&x=12&y=13


<gareththacke***@gmail.com> ha scritto nel messaggio
Show quote
news:1175610377.914987.300580@l77g2000hsb.googlegroups.com...
> 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
>
Author
3 Apr 2007 3:32 PM
Laura T.
"2. which of the many available timeouts controls the transaction timeout on
the DTC?"
I think it is this:
http://msdn2.microsoft.com/en-us/library/system.transactions.transactionmanager.maximumtimeout.aspx

Show quote
"Laura T." <L*@NOWHERE.COM> ha scritto nel messaggio
news:eWNhtRgdHHA.4012@TK2MSFTNGP03.phx.gbl...
> 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%3Ben-us%3B287499&x=12&y=13
>
>
> <gareththacke***@gmail.com> ha scritto nel messaggio
> news:1175610377.914987.300580@l77g2000hsb.googlegroups.com...
>> 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
>>
>
>
Author
4 Apr 2007 9:32 AM
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

AddThis Social Bookmark Button