We got error as below:
[ART.114.302] Adapter Runtime (Transaction): Error while committing transaction 6304. The transaction in progress is 6305.
This error only occured when we are doing the stresss testing. We use concurrent thread to test the same service and some works fine. Others got this error.
BTW, we use starttransaction, committransaction and rollback transaction. but we are using the defautlt transaction name. We don’t define a specific transaction name for the strart transaction service.
So how will this error come out?
Any comments are higyly appreciated.
This is typical situation of “Concurrent Commit conflicts” in a RDBMS. JDBC Adapter cannot commit a transaction if another Transaction has been started. This is to avoid “Dirty Reads” from the 2nd transaction. Please google on these keywords to understand these scenarios in detail.
In real world scenario, most of the times, the first transaction will commit before the 2nd transaction starts and you will not get this error.
Review the flow service code and make the following changes. If it is inserting a row at a time in loop, change it do batchInserts. Also, in the code Commit the transaction as soon as update/insert is done.
These changes will reduce the elapsed time between the startTransaction and commitTransaction and there will be less chance of getting this error.
Also, if you are expecting a lot of concurrent users, put the code in REPEAT ON FAILURE with the backoff time of 1 minute (or as needed).
Hopefully, in the next Repeat iteration, another transaction would have Commited by then and so it will not get that error.