You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?phpdeclare(ticks=1);
functiondummy() {
echo"got sigchild\n";
}
pcntl_signal(SIGCHLD,"dummy");
for ($i=0;$i<20;$i++)
if (pcntl_fork()==0)
pcntl_exec('/bin/sleep',["0.{$i}"]);
$done=0;
do {
$st=-1;
while (($pid=pcntl_waitpid(-1,$st,WNOHANG))>0)
echo"got pid {$pid}\n";
if ($pid==0)
usleep(550);
} while (20>$done);
This loops forever on 8.1.22 but work as expected on 8.1.21 and earlier. In both cases I am getting the SIGCHLD signal but with 8.1.22 pcntl_waitpid always returns zero.
I have tried to get the pcntl.c from 8.1.21 and recompile 8.1.22 with it, then it works. I suspect that the problem is in f39b513 that calls waitpid inside the signal handler without buffering the results for pcntl_waitpid to fetch later (it calls wait4/waitpid), but I did not dig further.
It is also strange that pcntl_waitpid uses wait4/waitpid but pcntl_signal_handler doesn't do the same.
PHP Version
PHP 8.1.22
Operating System
No response
The text was updated successfully, but these errors were encountered:
Description
The following code:
This loops forever on 8.1.22 but work as expected on 8.1.21 and earlier. In both cases I am getting the SIGCHLD signal but with 8.1.22 pcntl_waitpid always returns zero.
I have tried to get the
pcntl.c
from 8.1.21 and recompile 8.1.22 with it, then it works. I suspect that the problem is in f39b513 that callswaitpid
inside the signal handler without buffering the results forpcntl_waitpid
to fetch later (it callswait4
/waitpid
), but I did not dig further.It is also strange that
pcntl_waitpid
useswait4
/waitpid
butpcntl_signal_handler
doesn't do the same.PHP Version
PHP 8.1.22
Operating System
No response
The text was updated successfully, but these errors were encountered: