Sunday, March 10, 2013

Transaction timeout error | Long running feeds| New transaction

If you had to run feeds that would take longer than appserver transaction timeout or any process that runs for ever and if you have see the transaction timeout exception as below for any long running processes

0ddf0003a SystemErr     R Caused by: org.omg.CORBA.TRANSACTION_ROLLEDBACK: javax.transaction.TransactionRolledbackException:  ; nested exception is:
      javax.transaction.TransactionRolledbackException: Transaction is ended due to timeout  vmcid: 0x0  minor code: 0  completed: No
0ddf0003a SystemErr     R    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
0ddf0003a SystemErr     R    at sun.reflect.NativeConstructorAccessorImpl.newInstance(

I would not advise this code solution for all scenarios and only after considering all scenarios, If you need to add code to create new transaction and manage your transactions. Find below code example.

Solution: Using new transaction in your code.

int transactionSize=5000; //example transaction size

for (int recordCount=0; recordCount <= recordsFromDB.length; recordCount++)

    //do business logic
    if ( (transactionSize != null) && (recordCount%transactionSize.longValue() == 0) ) {

catch (Exception e) {
                logging(METHOD_NAME, "Exception at performExecute" + e.getMessage());


  1. Surely using TransactionManager is the last resort and carries performance 'side effects' concerned with the EJB container. The recommended IBM approach for long running transactions is the use of the AsyncControllerCommandImpl which will not timeout but requires that you update SCHSTATUS.

  2. Looking at the code in the if block you have started a transaction that is not closed in the code.

  3. Thank you, corrected, removed the second transactionManager.begin().

  4. But extending from AsyncControllerCommandImpl doesn't solve the problem, if you use AccessBeans. You have to control transactions, catching rolledback exceptions, and starting transactions and setting the owner of the handle to true.

  5. Hi,
    I am running through similar issue where my schedular job takes more than 300sec and times out. I came across few recommendations of increasing the transaction time in WAS. Any thoughts on this approach ?

  6. Even i am facing same kind of issue "javax.transaction.TransactionRolledbackException: Transaction is ended due to timeout" , what would be the best technical approach for this kind of issue which not give me any performance hit.

    My Scenario :- I have a scheduler which will run in every one hour , which will pick the orders with status as "M" from orders table and will process one by one to a third party system,in between i am doing some DB transaction, when the records are more i am getting the above error.
    Please let me know what should be done here to overecome from this situation.

    1. You can follow the tip mentioned here, but have the count limit to 500 to 1000.

    2. I didn't find the tip which you have suggested..Did i miss something ...Could you please put it once again.

  7. I don't think you would need TransactionManager.begin(); to begin with since commerce would have already started a transaction when you are in a Controller command call.
    I believe it should be

    if ( (transactionSize != null) && (recordCount%transactionSize.longValue() == 0) ) {
    TransactionManager.commit(); -- you are explicitly committing the transaction that was started by commerce
    TransactionManager.begin(); -- starting a new one so that commerce would call commit when it's done with controller command call.

  8. Hi ,

    I have scheduler which will run every one hour and pick the orders from orders table with status 'M' and by web service call to a external system and after the response will update the DB.For this i have configured the scheduler to run on one server in the cluster envirnoment by giving the "AllowedHostName" while configuring the scheduler.But sometimes the scheduler is picking the new orders and sometimes not..many times not picking.But while i am running manually it is picking. Please help me what needs to be done so that it will pick everytime.