locked
Promoted Transaction Timeout

    Question

  • Setup:
    I have a client and a server connected via .NET Remoting. Framework version 2.0, applications are running under a debugger on the local machine. MSDTC has been tested to be working fine both locally and with a development server.

    Scenario:
    At the client I start a transaction via TransactionScope. At the server I wish to integrate into that transaction, so to promote the transaction to a distributed transaction (e.g. MSDTC vs. STM) I sent it to the server. The act of serializing the transaction (Transaction.Current) appears to promote the transaction. This musch works just fine. The transaction is promoted and made the ambient transaction at the server side upon server entry. The server then proceeds to execute requests within the context of a new TransactionScope, this uses the ambient transaction correctly.

    Problem:
    Transactions are timing out even though I explicitly set a timeout for each transactionscope, for example:

    System.Transactions.TransactionOptions transactionOptions = new System.Transactions.TransactionOptions();
    transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.Serializable;
    transactionOptions.Timeout = TimeSpan.FromDays(1);
    using (System.Transactions.TransactionScope transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions, System.Transactions.EnterpriseServicesInteropOption.Automatic))
    {
    // ...
    }


    I have a very long import process being performed by the client, I need to complete 4 imports that will take an estimated 3 hours each. Now, each one will be done individually and the data verified, hopefully one a day next week.  But because the transactions are timing out I can't even get through a single test import that will take roughly 40 minutes to complete.

    Through the entire process there is client->server activity resulting in new transactionscope objects at the server on every request, and for each transaction scope the database is being hit at least once (and in some cases, several thousand times).  For a given transactionscope at the server only one sqlconnection is used.

    Hopefully someone knows something i don't, I'm hoping to have this ready by monday and I'm totally stumped.

    Thanks!
    Shaun Wilson

    Friday, November 18, 2005 1:51 AM

Answers

  • Hi Shaun,

    What is your machine config maxTimeout value for System.Transactions?

    Look in machine.config at:

    <configuration>

     <system.transactions>

      <machineSettings maxTimeout="00:10:00" />

     </system.transactions>

    </configuration>

    The default value is 10 minutes.

    Sunday, March 12, 2006 4:04 AM
  • MaxTimeout in machine.config is intended to be a setting for system administrators to limit the time transactions are kept alive and consequently the time locks are kept in databases. It is a protective setting and thus it cannot be overridden in code. If you need to increase the default value, you will need to edit the machine.config on all the involved computers where the transaction "travels" through System.Transactions.

     

    I agree that the MSDN docs can be better and point to this max timeout. I'll see how we can fix that.

    Monday, March 13, 2006 6:30 AM

All replies

  • Hi Shaun,

    What is your machine config maxTimeout value for System.Transactions?

    Look in machine.config at:

    <configuration>

     <system.transactions>

      <machineSettings maxTimeout="00:10:00" />

     </system.transactions>

    </configuration>

    The default value is 10 minutes.

    Sunday, March 12, 2006 4:04 AM
  • Hi Shaun,

    Just now I noticed that you posted this message on 11-18-2005 - I guess this thread was transferred from another forum here by a moderator. I hope that you have the answer to this problem by now. If not please let me know.

    All the best!

    Sunday, March 12, 2006 8:52 AM
  • Some more details about my problem, for other readers, if you see the problem I was seeing this may also be your solution.

    http://forums.microsoft.com/msdn/showpost.aspx?postid=144757&siteid=1

    I never modified the machine.config which was the most recent suggestion, by that time I had already moved on. Sadly, I gutted the outermost scope so we now have a 1.5hr nightly import process containing of dozens of un-affiliated transactions. What's worse is this handles the backbone of our company, if this were to fail and leave the target database in a mixed state we would be losing money by the minute.

    I don't know when I will have time to run this test, I will run it by my CIO next week, we just rolled out some new client tools for the employees and I'm expecting to get slammed with change requests etc.

    It would be nice to know (by reading the docs) whether this needs to be set on all involved machines or only the machine with the outermost scope. Also, it would be nice if this setting could be overridden for <a/the ambient> transaction. There's a means of changing the timeout for a txn, but it doesn't mean much if there's a hard limit set elsewhere... the docs should at least contain a Note or See Also that makes this setting apparent to developers (it may now, I have no idea, and I'll be completely embarassed if it did back then).

    Thanks! I'm fairly certain this will fix the problem.

     

    Sunday, March 12, 2006 2:19 PM
  • MaxTimeout in machine.config is intended to be a setting for system administrators to limit the time transactions are kept alive and consequently the time locks are kept in databases. It is a protective setting and thus it cannot be overridden in code. If you need to increase the default value, you will need to edit the machine.config on all the involved computers where the transaction "travels" through System.Transactions.

     

    I agree that the MSDN docs can be better and point to this max timeout. I'll see how we can fix that.

    Monday, March 13, 2006 6:30 AM
  • "

    I agree that the MSDN docs can be better and point to this max timeout. I'll see how we can fix that.

    "

     

    As of 4/24/2008, that had not been fixed.  20 hours down the drain...

     

    Here are some keywords to help the Googler: 10 minute timeout CommittableTransaction TransactionCompleted asynchronous unknown reason abort aborting why

    Thursday, April 24, 2008 2:38 PM
  • Try this :

    using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required,
                    new TransactionOptions()
                    { 
                        IsolationLevel = System.Transactions.IsolationLevel.Serializable,
                        Timeout = TimeSpan.FromSeconds(120)
                    }))

    Hope it can help.

    reference at: http://stackoverflow.com/a/5900770/1034986

    Friday, November 2, 2012 9:26 AM