Repository navigation
mpm_worker: exit at once from just_die(), as mpm_event - #1132
Merged
Merged
Conversation
just_die(), a child's SIGTERM handler until child_main() handles signals itself, ran clean_child_exit() (hooks, pool destruction, exit()), which is not async-signal-safe. Nothing needs cleaning that early: just _exit(0), as mpm_event since PR 70267. * server/mpm/worker/worker.c (just_die): _exit(0) rather than clean_child_exit(0). * changes-entries/worker-just-die.txt: New.
ylavic
force-pushed
the
trunk-worker-just-die
branch
from
November 30, 2026 11:19
868b089 to
ab71937
Compare
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.
just_die()is the SIGTERM handler a worker child installs right afterfork(), untilchild_main()blocks the signals (apr_setup_signal_thread()) and handles SIGTERM synchronously (apr_signal_thread(check_signal)). It calledclean_child_exit(0), so thechild_stopping/child_stoppedhooks,apr_pool_destroy(pchild)andexit()ran from the signal handler. None of that is async-signal-safe: if the interrupted thread is insidemalloc()or holds a lock those need, the child can hang or corrupt its heap.This is the same issue #1020 (PR 70267) fixed in mpm_event, and the same fix: nothing set up that early needs cleaning, so
just_die()now just calls_exit(0).It also matters for backporting the
child_stoppedhook to 2.4.x (r1898369, with mod_watchdog's use of it): without this, 2.4.x's worker would start runningchild_stopped, which joins the watchdog threads, from a signal handler. (mpm_prefork skips the hooks from its signal handler since r1898418; therejust_die()is the normal ungraceful exit, so it keeps its cleanup.)