Bug #81515 [NEW]: PDO-MySQL is Blocking Signal Prop
| From: | thewitness at cacti dot net | Date: | Fri, 08 Oct 2021 16:24:34 +0000 |
| Subject: | Bug #81515 [NEW]: PDO-MySQL is Blocking Signal Prop | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-237108@lists.php.net to get a copy of this message | ||
From: thewitness at cacti dot net
Operating system: x86_64
PHP version: Irrelevant
Package: PDO MySQL
Bug Type: Bug
Bug description:PDO-MySQL is Blocking Signal Prop
Description:
------------
It appears that if you install any signal handler for PHP, signal
propagation to the PDO MySQL library is blocked. So, as long as I have
say a long running query, the PHP script will not respond to the signal.
However, if I don't install a signal handler, the script will terminate
as expected. It's pretty strait forward to test.
Test script:
---------------
<?php
if (function_exists('pcntl_async_signals')) {
pcntl_async_signals(true);
} else {
declare(ticks = 1);
}
/* install signal handlers for UNIX only */
if (function_exists('pcntl_signal')) {
pcntl_signal(SIGTERM, 'etl_sig_handler', true);
pcntl_signal(SIGINT, 'etl_sig_handler', true);
}
// Using Cacti DB API...
$data = db_fetch_cell('SELECT SLEEP(50000)');
function etl_sig_handler($signo) {
switch ($signo) {
case SIGTERM:
case SIGINT:
echo "Boo!\n";
exit;
break;
default:
/* ignore all other signals */
}
}
Expected result:
----------------
These signals should not be blocked. If they are not blocked, the query
should be killed, but not necessarily the connection. At least if the
signal handlers were not blocked, we could kill either the connection or
the query out of band.
Actual result:
--------------
Currently, the PDO calls are blocked/masked. I have read that this may
be a limitation of the MySQL/MariaDB client library, but then why does
CTRL-C work if there is no signal handler installed?
--
Edit bug report at https://bugs.php.net/bug.php?id=81515&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81515&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81515&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81515&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81515&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81515&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81515&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81515&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81515&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81515&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81515&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81515&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81515&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81515&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81515&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81515&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81515&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81515&r=mysqlcfg