Bug #77335 [Opn->Csd]: PHP is preventing SIGALRM from specifying SA_RESTART

From: Date: Wed, 02 Oct 2019 11:32:19 +0000
Subject: Bug #77335 [Opn->Csd]: PHP is preventing SIGALRM from specifying SA_RESTART
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222987@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77335&edit=1 ID: 77335 Updated by: nikic@php.net Reported by: v-yitam at microsoft dot com Summary: PHP is preventing SIGALRM from specifying SA_RESTART -Status: Open +Status: Closed Type: Bug Package: PCNTL related Operating System: CentOS 7 or Ubuntu 18.04 PHP Version: Irrelevant -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This is fixed by https://github.com/php/php-src/commit/e98e1f92c98b7c8910c55835d8f67d0d9230cc8b, though it will be necessary to specify $restart_syscalls explicitly: pcntl_signal(SIGALRM, 'handleAlarm', true); Previous Comments: ------------------------------------------------------------------------ [2018-12-21 18:42:41] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77335&edit=1

« previous php.bugs (#222987) next »