Can not Update Same Record in Two Transactions

Hi Great community members

I have a question about the operation when doing the following operations.

1. Make one screen in the service studio
2. Place a button on the screen. Click the button to update the timestamp of the Foo Entity's Id = 1 record (do not use `GetFooForUpdate`)
3. Launch Chrome, login to the system as user A, and open the screen created in step 1
4. Start Edge, log in to the system as user B, and open the screen created in step 2
5. Set a breakpoint on the action created in step 2
6. Start the debugger
7. Click the button in the windows of steps 3 and 4
8. Advance the process in step 3 with the debugger to execute the update process
9. Advance the process of step 4 with the debugger to execute the update process
10. Wait about 2-3 minutes
11. An error occurs:
"Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated."

My expected behavior:

- Since the record is not locked in step 2, the process is executed without waiting as in step 10. The error of step 11 does not occur.
- Update of later committed process will be final state


Why do errors occur in step 11?


- I saw the following document because I think that transaction is related to this problem, but the problem was not solved.
[Handling Transactions-OutSystems

- The reason I try the operation I wrote above is because I am trying to test for optimistic locking. In the above operation, there is no processing for optimistic locking, so we expect that the update will complete without incident.


Platform Version (OutSystems Public Cloud)


Hi Hiroyuki,

I'm not quite sure from your description where/when the time-out occurs (on the first or second button click), and I'm also not sure how the debugger works in this case, with two different processes hitting the breakpoint. However, in general, if you update, but not yet commit, a record in the database, that record is locked until the transaction in which it is updated finishes (and is auto-comitted).

If you update a record, then hold the transaction in the debugger, no other process can update that record (not even outside OutSystems), and any process trying will be locked until the record is available again. If that takes too long, you get the error you showed above.


Thank you for your reply!

The problem is solved thanks to you :)

I noticed that what I was trying to do was "Dirty Write". I understand that this error occurred because "Dirty Write" can not be executed by SQL Server or Oracle.

> I'm not quite sure from your description where/when the time-out occurs (on the first or second button click)

I will add information for those who see this thread later.
In step 9, execute the `UpdateFoo` Action surrounded by a red frame in the image below. This execution is not complete and the above error occurs.