RFE: IdleTerminationTimeout directive to prefork/worker/event MPMs. - #726
Open
notroj wants to merge 11 commits into
Open
RFE: IdleTerminationTimeout directive to prefork/worker/event MPMs.#726notroj wants to merge 11 commits into
notroj wants to merge 11 commits into
Conversation
IdleTerminationTimeout as proposed in PR apache#529. * test/pyhttpd/env.py (HttpdTestEnv.read_pid_file): Moved here from the mod_systemd tests, which are no longer its only caller. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
packages below it are collected only on the platform they are named for. [skip ci] * test/modules/arch/linux/README: Note it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
server/mpm/worker/worker.c: Add IdleTerminationTimeout, which shuts the server down once all workers have been idle for that many seconds. * changes-entries/idle-termination-timeout.txt: Added. Submitted by: Alex/AT <85214814+AlexAT users.noreply.github.com> Github: closes apache#529
server/mpm/worker/worker.c (set_idle_termination_timeout): Reject an IdleTerminationTimeout which is not a non-negative number of seconds, rather than letting atoi() read it as zero. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
server/mpm/worker/worker.c (*_pre_config): Reset idle_termination_timeout with the other tunables, so that a reload which no longer configures it stops terminating the server. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
connection counts on every pass, not only when a timeout queue expires. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
decrement_connection_count, process_socket): Publish the open connection count where it changes. * server/mpm/event/event.c, server/mpm/prefork/prefork.c, server/mpm/worker/worker.c (server_is_idle, perform_idle_server_maintenance): Base IdleTerminationTimeout on whether anything has happened since the last check, timed from a timestamp rather than counted in maintenance cycles. A server under steady traffic terminated, connections held open by an async MPM were dropped, and the timeout expired early. * .github/workflows/linux.yml: Run the pytest suites under prefork too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
server/mpm/worker/worker.c: Give the idle timeout shutdown message its own APLOGNO. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
test/modules/arch/linux/test_004_socket_activation.py: Strip trailing whitespace. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
notroj
force-pushed
the
idle-termination-tests
branch
from
August 29, 2026 15:08
97ad1df to
117db2e
比较
--max-time. A server which accepts a connection and then never answers it hung the whole test run rather than failing it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
restart test under prefork, which is left with no children by "httpd -k restart". Reproduced on trunk without mod_systemd loaded, so this is a workaround for a separate bug. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
注册 for free
to join this conversation on GitHub.
Already have an account?
登录 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.
Builds on #529 by Alex/AT, which adds an
IdleTerminationTimeoutdirective tothe prefork, worker and event MPMs: the server terminates itself once idle, so
that a socket-activated instance hands its listening socket back to the service
manager rather than sitting there.
The first commit is that patch unchanged. The rest are a test suite and fixes
for what it turned up:
terminated. Idleness is now "nothing has happened since the last check".
The open connection count is now published where it changes rather than only
when a timeout queue expires, which also fixes
ConnsTotalreading zero inmod_statuswith connections open.early when children exited, and
num_bucketstimes too fast with more thanone listener bucket. It is now timed from a timestamp.
atoi(), so anything unparseable meant zero, thatis, terminate as soon as idle.
pre_config, so it survived a reload which nolonger configured it.
APLOGNO.test/modules/core/test_007_idle_termination.pycovers all of the above, andskips on MPMs which do not implement the directive. CI gains a prefork run of
the pytest suites, since nothing set
MPMbefore.Not done: documentation in
docs/manual/. The shutdown is also stillungraceful, which is safe now that it only fires with no connections open, but
that should be said in the docs.
Only the event MPM was exercised locally; prefork is covered by the new CI job.
🤖 Generated with Claude Code