0

While developing application in Moqui framework(1.4.1), a frustrating issue regarding the bitronix transaction timeout occurs. I am not able to understand the reason why this happens and the only solution to this is that I have to restart my system.

I would really like to know how can I rectify this problem.

The exception is like this

Exception screenshot

adityazoso
  • 514
  • 5
  • 15
  • Could you share more specific information about the error and related behavior you are seeing? Transaction timeout errors happen all the time and you can address them by increasing timeouts or changing tx structure, etc. I've never seen them result in requiring a system restart... would you share more details about what you mean by that? – David E. Jones Sep 17 '14 at 05:14
  • I have added the screenshot for the exception that I am getting. – adityazoso Sep 17 '14 at 09:07

2 Answers2

0

Setting the transaction timeout is done where the transaction is begun. This is in your code written using the Moqui tools such as a service or screen, or Java/Groovy/etc code that uses the Moqui TransactionFacade or the JTA interfaces directly.

By default Moqui screens are not run in transactions, unless you set the screen.@begin-transaction attribute to do so. Chances are your problem is in a long-running service, and by default Moqui services ARE run in transactions. Set the timeout using the service.@transaction-timeout attribute on the service that beings the transaction. By default services use a transaction already in place if there is one, so this needs to be on the outer most service where the transaction is actual begun.

For more details about services and transaction management see the Making Apps with Moqui book, available for download from moqui.org.

You may have another issue in your code and that is the socket timing out for the browser request (I see that as well in the log in your screenshot). There are some ways around this, but also some things you can't control so easily like when the browser times out. For a good UI it is also best not have your user sit and wait more than the typical 30-60s where such timeouts start hitting. Change your code to run in the background and if needed add something to your screen to monitor status and/or progress of the job.

David E. Jones
  • 1,721
  • 1
  • 9
  • 8
  • So what will be the best practices that I need to follow as to avoid this exception from reoccurring? Should I force a new transaction for every service? Will there be any issue later on with the system if the load increases? – adityazoso Sep 19 '14 at 06:01
  • There is no universal best practice, it depends on what you are doing so I would need more details. The general recommendations, without knowing what you are trying to do, are in my message before... like using background jobs. Forcing a new transaction for every service is a bad idea. Transactions should be structured by what you want to be atomic (all fail or succeed together), not by timing or other types of error handing. – David E. Jones Sep 20 '14 at 18:20
0

If you are loading large files with the java -jar load command, you can use the timeout parameter to set the timeout in seconds to lets say 3600, because the default is 600 seconds.

More about the load command parameters at:

java -jar moqui.war help 
Gilles-Antoine Nys
  • 1,481
  • 16
  • 21