docs: explain why the post-force-kill reboot wait must stay unbounded - #2577
Open
dunglas wants to merge 1 commit into
Open
docs: explain why the post-force-kill reboot wait must stay unbounded#2577dunglas wants to merge 1 commit into
dunglas wants to merge 1 commit into
Conversation
Bounding this wait and giving up on the stuck thread looks like the obvious fix for #2553 (one stuck thread wedging every reboot forever), and #2573 tried exactly that. It's unsafe: php_main() calls tsrm_shutdown() on every reboot cycle, which requires every PHP thread to have already exited. Giving up on a thread whose OS thread is still alive violates that and crashes the process (confirmed by CI on #2573). Leave a comment so the same fix isn't attempted again without this context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Comment-only change, no behavior change.
#2573 tried to bound this wait and abandon an unresponsive thread instead of blocking the whole reboot forever — a reasonable-looking fix for #2553's escalating hang. It's unsafe:
php_main()infrankenphp.cruns the same SAPI/TSRM teardown on every reboot cycle (not just final shutdown), andtsrm_shutdown()requires every PHP thread to have already exited first. Giving up on a thread whose OS thread is still alive and registered in TSRM tears down global engine state out from under it — a use-after-free confirmed by CI segfaults on that PR (see the discussion on #2573, now closed).Adding this as a comment so the next attempt at #2553 doesn't rediscover the same crash the hard way. #2570 and #2574 remain the correct lever: reduce how often a thread ever gets stuck like this, since recovering from it after the fact isn't safely possible.