Bug #80907 [NEW]: Seg fault with pcntl_alarm() when triggered while waiting on IO
From: tobias dot nyholm at gmail dot com
Operating system: OSX
PHP version: 7.4.16
Package: PCNTL related
Bug Type: Bug
Bug description:Seg fault with pcntl_alarm() when triggered while waiting on IO
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 bug report at https://bugs.php.net/bug.php?id=80907&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80907&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80907&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80907&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80907&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80907&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80907&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80907&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80907&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80907&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80907&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80907&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80907&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80907&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80907&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80907&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80907&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80907&r=mysqlcfg
Thread (8 messages)
- tobias dot nyholm at gmail dot com