Bug #80319 [NEW]: No error if the lock time exceeds innodb_lock_wait_timeout
| From: | ngyuki dot jp at gmail dot com | Date: | Thu, 05 Nov 2020 08:22:46 +0000 |
| Subject: | Bug #80319 [NEW]: No error if the lock time exceeds innodb_lock_wait_timeout | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-230109@lists.php.net to get a copy of this message | ||
From: ngyuki dot jp at gmail dot com
Operating system: Alpine Linux v3.12
PHP version: 7.4.12
Package: PDO MySQL
Bug Type: Bug
Bug description:No error if the lock time exceeds innodb_lock_wait_timeout
Description:
------------
If the following conditions are met, No error if the lock time exceeds
innodb_lock_wait_timeout.
- ATTR_EMULATE_PREPARES = false
- 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:
---------------
<?php
$pdo = new PDO('mysql:host=mysql;port=3306;dbname=test', 'test',
'pass',
[
PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);
$pdo->beginTransaction();
$stmt = $pdo->query('SELECT id FROM t FOR UPDATE');
$rows = $stmt->fetchAll();
var_dump([$stmt->errorCode(), $stmt->errorInfo(), $rows]);
sleep(5);
Expected result:
----------------
SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try
restarting transaction
Actual result:
--------------
array(3) {
[0]=>
string(5) "00000"
[1]=>
array(3) {
[0]=>
string(5) "00000"
[1]=>
NULL
[2]=>
NULL
}
[2]=>
array(0) {
}
}
--
Edit bug report at https://bugs.php.net/bug.php?id=80319&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80319&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80319&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80319&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80319&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80319&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80319&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80319&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80319&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80319&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80319&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80319&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80319&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80319&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80319&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80319&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80319&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80319&r=mysqlcfg