Bug #80907 [Com]: Seg fault with pcntl_alarm() when triggered while waiting on IO
Edit report at https://bugs.php.net/bug.php?id=80907&edit=1
ID: 80907
Comment by: dc dot link at yahoo dot fr
Reported by: tobias dot nyholm at gmail dot com
Summary: Seg fault with pcntl_alarm() when triggered while
waiting on IO
Status: Open
Type: Bug
Package: PCNTL related
Operating System: OSX
PHP Version: 7.4.16
Block user comment: N
Private report: N
New Comment:
Was unable to reproduce it with Mac Intel and M1 with and without debug. Does it occur all the time
and was it build from source or is it homebrew/macports ?
Previous Comments:
------------------------------------------------------------------------
[2021-03-25 14:44:29] tobias dot nyholm at gmail dot com
Description:
------------
When using pcntl_alarm() and the alarm is triggered when waiting for IO inside a
class, I get a "42064 segmentation fault".
If the for loop is executing in the global namespace, everything is fine.
Test script:
---------------
<?php
pcntl_async_signals(true);
pcntl_signal(SIGALRM, function () {
throw new \RuntimeException('Maximum execution time reached');
});
pcntl_alarm(2);
class Worker
{
public function work()
{
for ($i = 0; $i< 10; $i++) {
echo '.';
sleep(5);
}
}
}
$worker = new Worker();
$worker->work();
echo "end";
Expected result:
----------------
.PHP Fatal error: Uncaught RuntimeException: Maximum execution time reached in
/Users/tobias/Workspace/PHPStorm/bref/alarm.php:5
Stack trace:
#0 /Users/tobias/Workspace/PHPStorm/bref/alarm.php(13): {closure}(14, Array)
#1 /Users/tobias/Workspace/PHPStorm/bref/alarm.php(21): Worker->work()
#2 {main}
thrown in /Users/tobias/Workspace/PHPStorm/bref/alarm.php on line 5
Actual result:
--------------
⯠php alarm.php
.[1] 41920 segmentation fault php alarm.php
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80907&edit=1
Thread (8 messages)