-
Notifications
You must be signed in to change notification settings - Fork 7.9k
proc_get_status exitcode is -1 after setting SIGCHLD #11871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@campbsb actually it's unrelated but by-design. POSIX says about SIG_IGN
and "Consequences of Process Termination"
This is also observed in traces of your test script, where 119283 is the PHP process, 119284 the executed command
At first, there are children running and the PHP process is waiting for the child to exit. As soon as the child exits, the process' status information is discarded and the next call to wait4 in the parent returns ECHILD. |
Here are traces for when an empty signal handler is set, starting from the end of the nanosleeps, up until we write out the exitcode: Under RHEL7 PHP 8.1.21:
Under RHEL8 PHP 8.1.22:
It seems an additional wait4() call has slipped in there. |
Can you try the latest 8.1 development branch? Since this problem appeared in 8.1.22 this might be related to the change mentioned above. That change has been reverted in the current development branch. |
Thanks @nielsdos - testing shows the issue with setting a signal handler is resolved by your reversion in the 8.1.23-dev branch. |
Ok in that case I'm going to close this as resolved. |
Description
After setting SIGCHLD, proc_get_status() returns unreliable exitcode values
On both el7 PHP 8.1.21 and el8 PHP 8.1.22, setting SIGCHLD to SIG_IGN results in proc_get_status returning exitcode -1. See https://stackoverflow.com/questions/71354900/php-proc-get-status-exitcode-is-always-1-after-pcntl-fork
On el8 PHP 8.1.22, setting SIGCHLD to a signal handler results in proc_get_status returning exitcode -1, but el7 PHP 8.1.21 works correctly.
PHP Version
PHP 8.1.21 and PHP 8.8.22
Operating System
RHEL 8.8
The text was updated successfully, but these errors were encountered: