PDO does not throw an Exception for MAX_STATEMENT_TIME

Viewed 334

We are running Percona Server 5.6.36-82.1-log and PHP 7.0.19.

The database is setup using max_statement_time to automatically timeout queries after 10 seconds. And when running (very) slow queries in PHPMyAdmin they timeout with the proper mysql error.

But when running the queries in our webapp, using PDO. The query just stops after the timeout, but without raising an error / throwing an exception. The query just stops and has no results, just like a regular query stops without any results.

The PDO object is created with the ATTR_TIMEOUT = 1 option. And later we add ATTR_ERRMODE = ERRMORE_EXCEPTION, ATTR_DEFAULT_FETCH_MODE = FETCH_ASSOC ATTR_EMULATE_PREPARES = false

What is needed for this situation to throw an Exception like expected?

0 Answers
Related