Bug #76048 [Com]: max_execution_time is not respected
| From: | saurav1991 at gmail dot com | Date: | Mon, 05 Mar 2018 08:18:58 +0000 |
| Subject: | Bug #76048 [Com]: max_execution_time is not respected | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214197@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76048&edit=1
ID: 76048
Comment by: saurav1991 at gmail dot com
Reported by: rishabh dot pugalia at gmail dot com
Summary: max_execution_time is not respected
Status: Open
Type: Bug
Package: PDO MySQL
Operating System: Mac
PHP Version: 7.0.28
Block user comment: N
Private report: N
New Comment:
When client side prepared statement is used i.e PDO::ATTR_EMULATE_PREPARES => true, the expected
error PDOException: SQLSTATE[HY000]: General error: 3024 Query execution was interrupted, maximum
statement execution time exceeded is thrown
However on using server side prepared statements, this exception is not thrown.
Compared with a ruby script using the mysql2 client. The exception is thrown both when server side
prepared statement is used and when prepared query is sent to mysql directly.
This might have to do with how the prepared statement APIs of libmysqlclient are being used
internally.
Previous Comments:
------------------------------------------------------------------------
[2018-03-05 07:37:27] rishabh dot pugalia at gmail dot com
Description:
------------
PDO does not respect MySQL 5.7's new feature - max_execution_time()
The code below will explain further. Sadly the mysqli_* seg faults if the same native prepared
statement is executed.
Test script:
---------------
<?php
$connection = new PDO("mysql:host=127.0.0.1;dbname=experiments", 'root',
'');
// Setting this to true triggers a query directly but still the result is same (which is also weird)
$connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
// The query is supposed to take about 6s to execute
$stmt = $connection->prepare("select /*+ max_execution_time(1000) */ * from users where name
= ?");
$stmt->execute(['b08588d6-0f12-11e8-9637-7e0088aab9a1']);
var_dump($stmt->fetchAll());
var_dump($connection->errorInfo());
Expected result:
----------------
It should throw an error around what Mysql natively does:
"ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time
exceeded"
Actual result:
--------------
array(0) {
}
array(3) {
[0]=>
string(5) "00000"
[1]=>
NULL
[2]=>
NULL
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76048&edit=1