|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76525 mysqli::commit does not throw if MYSQLI_REPORT_ERROR enabled and mysqlnd used
Submitted: 2018-06-25 08:35 UTC Modified: 2020-10-28 12:01 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: willem at mollie dot nl Assigned: nikic (profile)
Status: Closed Package: MySQLi related
PHP Version: 7.1.19 OS: Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
33 + 43 = ?
Subscribe to this entry?

 [2018-06-25 08:35 UTC] willem at mollie dot nl
We experienced lost data because the mysqli::commit() function does not throw under some conditions if mysqlnd is used. We configured mysqli to use report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT.

We use a MySQL Galera cluster setup and during reboots of nodes deadlocks in the commit query can occur.

However, these deadlocks do not cause an exception to be thrown if the ::commit() method is used. Instead, false is returned. In practice, the call fails silently. 

Sending COMMIT queries manually works as expected (an exception is thrown on a dead lock).

You can see in that the error handling is missing for mysqlnd if you compare to I'd guess that the MYSQLI_REPORT_MYSQL_ERROR macro is missing. 

Expected result:
If the commit() method encounters a "Deadlock found when trying to get lock; try restarting transaction" error (1213 code), with report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT we expect it to throw mysqli_sql_exception.

Actual result:
False is returned, e.g. the report_mode is ignored. 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-12-13 16:01 UTC] dominik dot fiser at w3w dot cz
We have similar and probably related problem with Galera and mysql PDO.
Galera Cluster instead of standard MySQL/MariaDD could fail on commit query due to its replication mechanism (described e.g. at
We are using PPH 7.2.11 and mysql PDO with error mode PDO::ATTR_ERRMODE = PDO::ERRMODE_EXCEPTION.
That's really pain and very hard to find, if you are catching exceptions and there is no exception, no error and transaction is not commited in database. This should be fixed ASAP.
 [2018-12-13 16:22 UTC] willem at mollie dot nl
Dominik, we fixed it by switching to using a COMMIT query instead of the method.
 [2020-10-28 08:59 UTC]
-Assigned To: +Assigned To: nikic
 [2020-10-28 10:39 UTC]
-Status: Assigned +Status: Closed
 [2020-10-28 12:01 UTC] willem at mollie dot nl
Cheers it is marvellously appreciated.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Mar 22 20:03:59 2023 UTC