Stop promising worker recycling by request count - #365
Merged
Merged
Conversation
Docs: - The feature list promised recycling "by request count or memory threshold". The request-count half has not existed since WORKER_MAX_REQUESTS became parsed-and-ignored in 0.5.0, so a reader who came for an equivalent of php-fpm's pm.max_requests found a promise in the most-read file and no setting behind it. README, the oxphp_worker() stub docblock and the worker.php example now name what the loop actually exits on. - Those two also gained the exit no list carried: a dynamic pool retires an idle worker while the server keeps running, so the block after oxphp_worker() is not a shutdown hook.
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.
Problem
The README feature list promised Automatic recycling "by request count or memory threshold". There is no request-count recycling.
oxphp_serve_loop()leaves its loop on four conditions — the server shutting down,Worker::scheduleExit(), theWORKER_MAX_MEMORY_MIBceiling, and a breaker of three consecutive requests that hit a fatal error — and the request counter it does keep drives only periodicgc_collect_cycles(). The request-count half stopped existing in 0.5.0, whenWORKER_MAX_REQUESTSbecame a variable that is parsed, warned about and otherwise ignored, so anyone who came looking for an equivalent of php-fpm'spm.max_requestsfound a promise in the most-read file in the repository and no setting anywhere behind it.The same stale claim sat in two more published artifacts that a search for the README's wording would not have found — it took a search for
max_requestsrather than for "request count":oxphp.stub.php— "exits the loop on max_requests/max_memory limits"www/worker.php— "Reached on graceful shutdown, max_requests, or max_memory limit"docs/features/worker-mode.md,docs/php/functions.md,docs/operations/configuration.mdanddocs/operations/metrics.mdalready described the real conditions, so the divergence was in these three files alone.What changed
oxphp_worker()stub docblock lists what the loop actually exits on, replaces the deprecatedWORKER_FILEwithWORKER_MODE_ENABLED=trueandENTRY_FILE, and states the return value accurately:trueonce the loop exits for any reason,falseonly outside worker mode.www/worker.phpmatches, and its section header is now "Teardown" rather than "Graceful shutdown", because the block below it is not a shutdown hook.Both the stub and the example also gained an exit that no list in the repository carried: with a dynamic pool (
PHP_WORKERS=MIN:MAX) the scale manager retires an idle worker while the server keeps running, and that reaches PHP the same way a shutdown does. An application that closes persistent connections afteroxphp_worker()returns was being told this happens only when the server stops.No behaviour changes — documentation and comments only.
Verification
scripts/check-links.sh— 637 in-repo links, none broken. The new anchor link was confirmed to be genuinely checked by planting a deliberately broken fragment and watching the script reject it.scripts/gen-llms-txt.sh --check— unchanged, since the generated files are built fromdocs/and no page there was touched.cargo fmt -- --check,cargo clippy --no-default-features -- -D warnings,cargo test --no-default-features— all clean.