Skip to content

Stop promising worker recycling by request count - #365

Merged
diolektor merged 1 commit into
mainfrom
fix/readme-claims-recycling-by-request-count
Sep 19, 2026
Merged

diolektor merged 1 commit into
mainfrom
fix/readme-claims-recycling-by-request-count

Conversation

@diolektor

Copy link
Copy Markdown
Contributor

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(), the WORKER_MAX_MEMORY_MIB ceiling, and a breaker of three consecutive requests that hit a fatal error — and the request counter it does keep drives only periodic gc_collect_cycles(). The request-count half stopped existing in 0.5.0, when WORKER_MAX_REQUESTS became a variable that is parsed, warned about and otherwise ignored, so anyone who came looking for an equivalent of php-fpm's pm.max_requests found 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_requests rather 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.md and docs/operations/metrics.md already described the real conditions, so the divergence was in these three files alone.

What changed

  • README names the three recycling conditions, says that they are worker-mode behaviour, and links to the Recycling section that carries the nuance (an uncaught exception does not count toward the breaker).
  • oxphp_worker() stub docblock lists what the loop actually exits on, replaces the deprecated WORKER_FILE with WORKER_MODE_ENABLED=true and ENTRY_FILE, and states the return value accurately: true once the loop exits for any reason, false only outside worker mode.
  • www/worker.php matches, and its section header is now "Teardown" rather than "Graceful shutdown", because the block below it is not a shutdown hook.
  • CHANGELOG records the correction under Fixed.

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 after oxphp_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 from docs/ and no page there was touched.
  • cargo fmt -- --check, cargo clippy --no-default-features -- -D warnings, cargo test --no-default-features — all clean.
  • A repo-wide search leaves no promise of request-count recycling outside the historical changelog entries for released versions, which stay as the record they are.

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.
@diolektor
diolektor merged commit c331dc8 into main Sep 19, 2026
7 checks passed
@diolektor
diolektor deleted the fix/readme-claims-recycling-by-request-count branch September 19, 2026 19:36
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