Extending the transaction timeout produces a never ending warning

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Extending the transaction timeout produces a never ending warning

#1

Postby Segi » Tue Jul 14, 2020 10:17 pm

I wrote a function in Verj called createExcelReport() that generates an Excel document based on a JSON object which is a "recipe" for the Excel data and columns to put into the document. This report is then emailed to the end user.

The average times it takes to generate a report can be anyone from 2-10 minutes.

This function is called from 1 of 2 different places.

The first is by visiting a form and clicking on an Excel icon which calls createExcelReport() for one part number and emails the report to the user. This does not have any issues and has not ever timed out on me.

I also have another application that lets you add part numbers to a queue. There is a scheduled task that runs after hours that processes these parts one by one and calls createExcelReport() for each of these parts and emails each document to the user who requested it as it gets generated.

I found that when you add a lot of parts to the queue, Verj eventually throws a transaction timeout error because it appears that Verj counts the transaction time as the sum of the time it takes to create the report for each individual part and not the time it takes to generate the report for an individual part number.

To fix this, I added system.transactionManager.setDefaultTransactionTimeout(3600); at the top of createExcelReport() to extend the timeout period.

This seems to fix the transaction timeout error but has a very annoying side effect where there are 4 warning messages printed every second to the server logs non-stop. Even after the report has successfully run, these messages continue.

The messages are:

Code: Select all

14-Jul-2020 14:59:40.229 WARNING [WfMS Queue Processor] com.atomikos.logging.JULLogger.logWarning Attempt to create a transaction with a timeout that exceeds maximum - truncating to: 2000000
14-Jul-2020 14:59:40.483 WARNING [WfMS Queue Processor] com.atomikos.logging.JULLogger.logWarning Attempt to create a transaction with a timeout that exceeds maximum - truncating to: 2000000
14-Jul-2020 14:59:40.735 WARNING [WfMS Queue Processor] com.atomikos.logging.JULLogger.logWarning Attempt to create a transaction with a timeout that exceeds maximum - truncating to: 2000000
14-Jul-2020 14:59:40.987 WARNING [WfMS Queue Processor] com.atomikos.logging.JULLogger.logWarning Attempt to create a transaction with a timeout that exceeds maximum - truncating to: 2000000
These messages only appear when you call createExcelReport() and appear about 4 times per second. The warning messages only stop if you restart the server. This has made it difficult to debug any problems because real errors and debugging info are getting lost among hundred of thousands of lines of these warning messages.

Removing system.transactionManager.setDefaultTransactionTimeout(3600); causes these warning messages to go away but causes the transaction timeout issue to return.

I am also confused by the fact that I am setting the timeout to 3600 (60 minutes) but the message says that the timeout exceeds the maximum which is 2,000,000 which is far higher than the value that I am setting it to.
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

Re: Extending the transaction timeout produces a never ending warning

#2

Postby Jon » Wed Jul 15, 2020 2:02 pm

Hi Segi,
The discrepancy in the numbers is because the transaction manager atomikos accepts a number in milliseconds, hence the value being set is actually 3600000.

Either change the value you are setting to 2000 or lower, or alternatively add the following parameter to the Embedded Server's Java arguments (File > Preferences > Servers);
-Dcom.atomikos.icatch.max_timeout=4000000

You should really set the timeout value back to its original value at the end of the scheduled task otherwise the system will use the new value for all transactions - see the javadoc for setDefaultTransactionTimeout - something like this:

Code: Select all

var originalTimeoutValue = system.transactionManager.defaultTransactionTimeout;
try {
  system.transactionManager.setDefaultTransactionTimeout(3600);
  // Start a new transaction with the new timeout value
  system.transactionManager.commitAndRestartTransaction();
  .. the rest of your code goes here
}
finally {
  system.transactionManager.setDefaultTransactionTimeout(originalTimeoutValue);
}
Jon
0 x

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

Re: Extending the transaction timeout produces a never ending warning

#3

Postby Segi » Wed Jul 15, 2020 9:08 pm

Jon,

Thanks. I didn't realize that that was the cause. I lowered the timeout to 1800 and that message has disappeared.

Thanks
0 x


Who is online

Users browsing this forum: No registered users and 12 guests