Skip to content

docs: explain why the post-force-kill reboot wait must stay unbounded - #2577

Open
dunglas wants to merge 1 commit into
mainfrom
docs-tsrm-reboot-constraint
Open

docs: explain why the post-force-kill reboot wait must stay unbounded#2577
dunglas wants to merge 1 commit into
mainfrom
docs-tsrm-reboot-constraint

Conversation

@dunglas

@dunglas dunglas commented Jul 28, 2026

Copy link
Copy Markdown
Member

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() in frankenphp.c runs the same SAPI/TSRM teardown on every reboot cycle (not just final shutdown), and tsrm_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.

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.
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.

1 participant