Transaction gets committed after getting interrupted by a request timeout

Description

When a request gets interrupted by a request timeout whilst in a transaction, the transaction still gets committed.

With the example below, only the logs up to the sleep get logged as expected. What is not expected is that the create statement still gets committed to the database. This leaves us with a very messy situation where there are a lot of incomplete data in our systems.

Example code:

Environment

OS: Windows Server 2019
Lucee 5.3.2.77, Apache Tomcat/9.0.20
Java Version OpenJDK 11.0.3

Activity

Show:

Pothys - MitrahSoft 20 January 2025 at 11:22
Edited

I have investigated this ticket with Lucee version 6.2.0.286-SNAPSHOT. When I executed the above code using sleep(), it worked as expected. Everything functions correctly in the latest version of Lucee, so I am closing this ticket. If the issue occurs in any scenario, we can reopen the ticket.

6 September 2022 at 13:14

It works as expected with the sleep() function. I have tried it with actual work between the insert and the update statement to better simulate our actual code. Most calls do work, but 1 in ~5 do not roll back the insert.

Putting the rollback in a cffinally block does seem rollback reliably. A possible workaround, albeit very ugly, would be initializing a success boolean with false at the start at the of the transaction and setting it to true if you reach the end of the relevant code. That way you can determine in the cffinally whether to rollback or not. Setting it in the cfcatch is not an option because that code does not reliably run.

6 September 2022 at 12:37

It is an insert statement in my actual test code. I made a mistake when changing it to a placeholder.

Zac Spitzer 6 September 2022 at 10:36

not sure if it’s relevant, but a CREATE (aka DDL) statement doesn’t rollback with transactions (which database BTW?)

Pothys - MitrahSoft 6 September 2022 at 10:12
Edited

thanks for the input


I've checked this ticket with the Lucee latest version 5.3.10.67-SNAPSHOT. using single cfsleep tag didn't triggers timeout error and using multiple sleep tags the request timeout error triggered and the transaction gets committed. But If I'm using single sleep function(sleep(5000)) instead of cfsleep tag the request timeout error is occurred and transaction didn't get committed.

so could you please check this  with the sleep() function in latest version and report here back?

Fixed

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 9 June 2021 at 12:24
Updated 20 January 2025 at 11:26
Resolved 20 January 2025 at 11:26