'Yii1 DB transaction timeout is ignored when selecting for update and the row is locked longer than the timeout
When the DB transaction is timeouted the transaction is still active and seems to only finish executing after PHP transaction timeout
If I lock the table outside of Yii and do not commit
START TRANSACTION;
SELECT * FROM `table_name` t WHERE t.`id` = 1 FOR UPDATE;
And then call an HTTP request where it's trying to acquire a lock on the table row and I do not commit the transaction above
Yii::app()->db->createCommand("SELECT * FROM `table_name` t WHERE t.`id` = 1 FOR UPDATE WAIT 2")->execute();
If I commit the transaction that has the lock AFTER MORE THAN 2 SECONDS the command finishes executing instantly and gives the error of the transaction timeout.
I would expect the transaction to finish when the timeout error happens, did anyone had this issue or know how to fix it?
PHP 7.4.25 mariadb:10.4 Yii 1.1.25
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|