|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Killing a process while in a TransactionScopeWe'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 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 > "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 >> > > |
|||||||||||||||||||||||