Bug #81195 [Com]: pcntl_fork() cause child process hungup.
Edit report at https://bugs.php.net/bug.php?id=81195&edit=1
ID: 81195
Comment by: martijn at squeezely dot tech
Reported by: jedemon at gmail dot com
Summary: pcntl_fork() cause child process hungup.
Status: Open
Type: Bug
Package: PCNTL related
Operating System: CentOS7 and Ubuntu16
PHP Version: 7.4.20
Block user comment: N
Private report: N
New Comment:
got the same issue on following system:
cat /etc/issue
Ubuntu 20.04.2 LTS \n \l
php -v
PHP 7.4.21 (cli) (built: Jul 1 2021 16:09:41) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies
with blackfire v1.62.0~linux-x64-non_zts74, https://blackfire.io, by Blackfire
Previous Comments:
------------------------------------------------------------------------
[2021-06-23 08:44:11] requinix@php.net
I can't reproduce on Ubuntu 18.04.
If pcntl_wait is indeed waiting then that means the process has a child, and I don't see how
your -r code could create a third (grand)child process. While it hangs, how many "php"
processes are running on the system?
------------------------------------------------------------------------
[2021-06-23 08:09:28] jedemon at gmail dot com
Description:
------------
From php7.4.11 to php7.4.20, when execute pcntl_fork(), the forked child process will not terminate.
Execute this line:
php -r "\pcntl_fork(); if(posix_getpid()){pcntl_wait(\$st);} echo
'exit'.PHP_EOL;"
and shell will hung.
This dose not happen in under PHP7.4.10, nor in above PHP8.0+. Tested on Centos7 and Ubuntu16.04.
There is no related info I can find out.
Test script:
---------------
php -r "\pcntl_fork(); if(posix_getpid()){pcntl_wait(\$st);} echo
'exit'.PHP_EOL;"
Expected result:
----------------
exit
exit
Actual result:
--------------
exit
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81195&edit=1
Thread (4 messages)