Skip to content
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

Fix finished process handling in PHP 8.1.22/8.2.9 #212

Merged
merged 3 commits into from
Aug 25, 2023

Conversation

matthi4s
Copy link
Contributor

I'm not sure if this even should be merged since it will probably be obsolete in a few weeks, but currently, this library is broken in the latest PHP versions 8.1.22 and 8.2.9 due to this change: php/php-src#11509

From what I understand, without this change, SIGCHILD is received inconsistently so pcntl_waitpid() is used to correctly check finished child processes. With this change, SIGCHILD is received consistently, but pcntl_waitpid() doesn't return those processes after that, maybe because they are already considered handled?

Therefore in PHP 8.1.22 and 8.2.9, the finished processes are never handled and the waiting process hangs indefinitely. Because this is BC breaking, this was already reverted in PHP and will be back to the previous behavior in future PHP versions: php/php-src#11863

I've added special handling for only the affected PHP versions, where the SIGCHILD is handled immediately without pcntl_waitpid(). All other PHP versions should have the same behavior as before. I'm not sure if that's the best fix, but the tests pass in PHP 8.2.9.

@AlexVanderbist
Copy link
Member

Hi, I gave the test suite a quick run on 8.2.6 and 8.2.9 and this seems like a good fix for the issue. Thanks!

@AlexVanderbist AlexVanderbist merged commit 24a8ffa into spatie:master Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants