|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80319 No error if the lock time exceeds innodb_lock_wait_timeout
Submitted: 2020-11-05 08:22 UTC Modified: 2020-12-03 07:03 UTC
From: ngyuki dot jp at gmail dot com Assigned:
Status: Closed Package: PDO MySQL
PHP Version: 7.4.12 OS: Alpine Linux v3.12
Private report: No CVE-ID: None
 [2020-11-05 08:22 UTC] ngyuki dot jp at gmail dot com
If the following conditions are met, No error if the lock time exceeds innodb_lock_wait_timeout.

- WHERE is not specified

MySQL(8.0.22) contains the following data.

    create table t ( id int not null primary key auto_increment );
    insert into t values (1);

Run the test script as follows.

    (php test.php >/dev/null) & (sleep 1 && php test.php)

Setting ATTR_EMULATE_PREPARES = true or WHERE id = 1 results in an error, as expected.

Test script:
$pdo = new PDO('mysql:host=mysql;port=3306;dbname=test', 'test', 'pass', [


$stmt = $pdo->query('SELECT id FROM t FOR UPDATE');
$rows = $stmt->fetchAll();
var_dump([$stmt->errorCode(), $stmt->errorInfo(), $rows]);


Expected result:
SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction

Actual result:
array(3) {
  string(5) "00000"
  array(3) {
    string(5) "00000"
  array(0) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-05 08:26 UTC] ngyuki dot jp at gmail dot com
This test specifies innodb_lock_wait_timeout=1 in MySQL.
 [2020-11-05 08:28 UTC]
-Status: Open +Status: Feedback
 [2020-11-05 08:28 UTC]
Please try the upcoming PHP 7.4.13 release. A lot of bugs relating to this issue will be fixed in this release.
 [2020-11-15 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2020-12-03 07:03 UTC] ngyuki dot jp at gmail dot com
-Status: No Feedback +Status: Closed
 [2020-12-03 07:03 UTC] ngyuki dot jp at gmail dot com
Confirmed that this has been fixed in PHP 7.4.13.
Thank you!
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Oct 23 21:03:34 2021 UTC