|  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: 2019-10-02 11:32 UTC
Avg. Score:3.3 ± 0.5
Reproduced:0 of 0 (0.0%)
From: v-yitam at microsoft dot com Assigned: nikic (profile)
Status: Closed Package: PCNTL related
PHP Version: Irrelevant OS: CentOS 7 or Ubuntu 18.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: v-yitam at microsoft dot com
New email:
PHP Version: OS:


 [2018-12-21 18:42 UTC] v-yitam at microsoft dot com
When signo is SIGALRM, it never gets to the else clause, see this line here,

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 ] )

For your reference, please check 

Test script:
You can find the repro for pdo_sqlsrv in


$pdo = new PDO('sqlsrv:Server=;Database=', '', '');

function handleAlarm() {
        echo "Received SIGALRM!";

pcntl_signal( SIGALRM, 'handleAlarm');

while(1) {
        $testresult = $pdo->query("SELECT * FROM users;");
        foreach($testresult as $r) {}
        echo '.';

Expected result:
No exception thrown

Actual result:
Exception thrown


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


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-02 11:32 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2019-10-02 11:32 UTC]
This is fixed by, though it will be necessary to specify $restart_syscalls explicitly:

pcntl_signal(SIGALRM, 'handleAlarm', true);
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 17:01:27 2024 UTC