Bug #80319 [Opn->Fbk]: No error if the lock time exceeds innodb_lock_wait_timeout

From: Date: Thu, 05 Nov 2020 08:28:13 +0000
Subject: Bug #80319 [Opn->Fbk]: No error if the lock time exceeds innodb_lock_wait_timeout
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230111@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80319&edit=1 ID: 80319 Updated by: nikic@php.net Reported by: ngyuki dot jp at gmail dot com Summary: No error if the lock time exceeds innodb_lock_wait_timeout -Status: Open +Status: Feedback Type: Bug Package: PDO MySQL Operating System: Alpine Linux v3.12 PHP Version: 7.4.12 Block user comment: N Private report: N New Comment: Please try the upcoming PHP 7.4.13 release. A lot of bugs relating to this issue will be fixed in this release. Previous Comments: ------------------------------------------------------------------------ [2020-11-05 08:26:13] ngyuki dot jp at gmail dot com This test specifies innodb_lock_wait_timeout=1 in MySQL. ------------------------------------------------------------------------ [2020-11-05 08:22:46] ngyuki dot jp at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=80319&edit=1

« previous php.bugs (#230111) next »