php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77335 PHP is preventing SIGALRM from specifying SA_RESTART
Submitted: 2018-12-21 18:42 UTC Modified: -
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:0 of 0 (0.0%)
From: v-yitam at microsoft dot com Assigned:
Status: Open Package: PCNTL related
PHP Version: Irrelevant OS: CentOS 7 or Ubuntu 18.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-12-21 18:42 UTC] v-yitam at microsoft dot com
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

Patches

php_signal_diff.log (last revision 2018-12-21 18:43 UTC by v-yitam at microsoft dot com)

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat May 25 01:01:26 2019 UTC