Syndicate

News

My name's Marco De Sanctis and I'm an IT professional from Italy. This is my technical blog, about .NET and related application development and design technologies.

Download my Resume (.doc)

Recent Comments

10/23/2008 at 3:48 PM

sorry, my previous post was not complete... I trie...
by glondi

Read more...

9/22/2008 at 10:03 AM

Good one!!!Could you please post source code for t...
by Nisa

Read more...

9/10/2008 at 5:53 PM

I didn't even realize people were aware of the WPF...
by Mike Brown

Read more...

9/8/2008 at 1:22 AM

Marco,How are you handling scenarios where you nee...
by ctodd

Read more...

9/3/2008 at 1:00 AM

@ctodd: Hi,basically for the reasons I described a...
by Marco De Sanctis

Read more...

Recent Posts

Crunch mode is a pure waste of time, energy and money

7/31/2008 at 5:41 PM

Read more...

Double Click on the .sln file doesn't open Visual Studio on Vista

7/27/2008 at 9:02 AM

Read more...

Domain Model & Aggregates: when do master-detail associations happen?

7/22/2008 at 4:08 PM

Read more...

How I Got Started in Software Development

7/14/2008 at 12:16 AM

Read more...

Unleash the power of VisualStateManager with custom states

6/30/2008 at 12:12 AM

Read more...

TransactionScope timeout

posted on Saturday, June 14, 2008 12:01 AM | Filed Under [ Misc ]

TransactionScope constructor has an overload that lets you specify a transaction timeout:

image

The example above sets up a 1 hour timeout on the new transaction. I was using a similar approach to execute an Oracle stored procedure which was doing some batch processing that took about 30 mins. to complete. Anyway, I could se the transaction being rolled back after about 10 minutes, even though the OracleCommand itself had a proper timeout and no exception was raised by the underlying stored procedure.

Pretty strange, isn't it?

After some research, I've discovered that the TransactionManager class, which ultimately manages the transactions lifespan, has a readonly MaximumTimeout property, that can be set only at machine.config level and has a default value of 10 minute:

image

This is the maximum time limit your transaction can last, regardless of what you specify on the aforementioned constructor. In my case, I decided to move it to one hour limit.

Hopes this saves you a little time ;-)

kick it on DotNetKicks.com

Comments

Gravatar
# re: TransactionScope timeout
Posted by Gian Maria on 6/14/2008 4:14 PM
Yep, it happened to me too. It violates the principle of least surprise. if there is a maximum value it would be good if the class would not expose a timeout value, or it raise an exeption when the value used in the constructor is superior to that in machine config ;)

Alk.
Gravatar
# re: TransactionScope timeout
Posted by Keith G on 7/14/2008 10:12 PM
Are you concerned that changing the value changes the behavior for all programs that use TransactionScope?
Gravatar
# re: TransactionScope timeout
Posted by Marco De Sanctis on 7/14/2008 11:50 PM
Sure I am... but if you got batches that last for more than 10 mins, I don't think you have any other option.
Gravatar
# re: TransactionScope timeout
Posted by Mathias on 7/22/2008 7:49 PM
Been there too in a past project! I remember this wasn't a fun episode; we couldn't figure out what the issue was initially, and the only way to verify that the problem is fixed is to run a (pretty) long transaction. We got lots of fun 10-minutes stretches, anxiously waiting in front of the computer...
Gravatar
# lpxbdsxw
Posted by lpxbdsxw on 11/5/2008 2:28 PM
lpxbdsxw
Gravatar
# axqtblwd
Posted by axqtblwd on 11/7/2008 10:11 PM
axqtblwd
Gravatar
# ztxlqbhy
Posted by ztxlqbhy on 11/7/2008 10:29 PM
ztxlqbhy
Gravatar
# oanctvnq
Posted by oanctvnq on 11/7/2008 10:29 PM
oanctvnq
Gravatar
# jchungyx
Posted by jchungyx on 11/7/2008 10:29 PM
jchungyx
Gravatar
# gvhztvtq
Posted by gvhztvtq on 11/7/2008 10:29 PM
gvhztvtq
Gravatar
# ulsedngz
Posted by ulsedngz on 11/7/2008 10:30 PM
ulsedngz
Gravatar
# generic valium
Posted by generic valium on 11/10/2008 12:09 AM
generic valium
Gravatar
# advil
Posted by advil on 11/10/2008 12:09 AM
advil
Gravatar
# testosterone
Posted by testosterone on 11/10/2008 12:10 AM
testosterone
Gravatar
# gwlnetje
Posted by gwlnetje on 11/10/2008 6:32 AM
gwlnetje
Gravatar
# psnngpph
Posted by psnngpph on 11/10/2008 6:32 AM
psnngpph
Gravatar
# ciprofloxacin
Posted by ciprofloxacin on 11/12/2008 2:31 PM
ciprofloxacin
Gravatar
# cipro
Posted by cipro on 11/12/2008 2:32 PM
cipro
Gravatar
# zvbhhste
Posted by zvbhhste on 11/12/2008 9:21 PM
zvbhhste
Gravatar
# nxnkftaa
Posted by nxnkftaa on 11/12/2008 9:21 PM
nxnkftaa
Gravatar
# ngfpfnla
Posted by ngfpfnla on 11/12/2008 9:21 PM
ngfpfnla
Gravatar
# kvkehoji
Posted by kvkehoji on 11/12/2008 10:31 PM
kvkehoji
Gravatar
# cnjssiqg
Posted by cnjssiqg on 11/12/2008 10:32 PM
cnjssiqg
Gravatar
# apiooees
Posted by apiooees on 11/12/2008 10:32 PM
apiooees
Gravatar
# mojtggpn
Posted by mojtggpn on 11/12/2008 10:32 PM
mojtggpn
Gravatar
# wrivulpy
Posted by wrivulpy on 11/12/2008 10:33 PM
wrivulpy
Comments have been closed on this topic.