Bug #77335 [NEW]: PHP is preventing SIGALRM from specifying SA_RESTART
| From: | v-yitam at microsoft dot com | Date: | Fri, 21 Dec 2018 18:42:41 +0000 |
| Subject: | Bug #77335 [NEW]: PHP is preventing SIGALRM from specifying SA_RESTART | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-218557@lists.php.net to get a copy of this message | ||
From: v-yitam at microsoft dot com
Operating system: CentOS 7 or Ubuntu 18.04
PHP version: Irrelevant
Package: PCNTL related
Bug Type: Bug
Bug description:PHP is preventing SIGALRM from specifying SA_RESTART
Description:
------------
When signo is SIGALRM, it never gets to the else clause, see this line
here,
https://github.com/php/php-src/blob/master/ext/pcntl/php_signal.c#L44
Note that even though $restart_syscalls is true by default, it does not
help or do anything:
bool pcntl_signal ( int $signo , callable|int $handler [, bool
$restart_syscalls = TRUE ] )
http://php.net/manual/en/function.pcntl-signal.php
For your reference, please check
https://www.postgresql.org/message-id/E1UnwKf-0002LU-W4@gemulon.postgresql.org
Test script:
---------------
You can find the repro for pdo_sqlsrv in
https://github.com/Microsoft/msphpsql/issues/885
<?php
$pdo = new PDO('sqlsrv:Server=;Database=', '', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
function handleAlarm() {
echo "Received SIGALRM!";
pcntl_alarm(2);
}
pcntl_async_signals(true);
pcntl_signal( SIGALRM, 'handleAlarm');
pcntl_alarm(2);
while(1) {
$testresult = $pdo->query("SELECT * FROM users;");
foreach($testresult as $r) {}
echo '.';
}
Expected result:
----------------
No exception thrown
Actual result:
--------------
Exception thrown
--
Edit bug report at https://bugs.php.net/bug.php?id=77335&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77335&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77335&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77335&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77335&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77335&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77335&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77335&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77335&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77335&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77335&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77335&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77335&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77335&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77335&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77335&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77335&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77335&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77335&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77335&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77335&r=mysqlcfg