mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2435] [CLOSED] [Other] serve: return 503 when the elastic image encoder cannot start #4044
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4044
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2435
Author: @i-Vladimir-i
Created: 10/14/2026
Status: ❌ Closed
Base:
main← Head:vision-elastic-split📝 Commits (3)
a38d24b[Codex]: return 503 when an elastic image encoder cannot startde511d3[Codex]: cover elastic encoder HTTP retries and recoveryd7059eb[Codex]: update elastic vision tests on current main and cover real startup failures📊 Changes
4 files changed (+183 additions, -6 deletions)
View changed files
📝
docs/VRAM_ELASTIC.md(+3 -1)📝
serve/server.py(+16 -4)📝
serve/test_vision_elastic.py(+24 -1)➕
serve/test_vision_elastic_http.py(+140 -0)📄 Description
Problem and result
When an elastic image encoder fails to restart, its exception escapes request preparation and the client gets a closed connection.
Return HTTP 503 with the startup reason instead. Later image requests retry; text requests and recovery after a successful start keep working.
Log an idle encoder stop even when its cache shrink was refused, and warn that a layer split needs a static reserve for the encoder.
Related discussion and CI prerequisite
Continues this PR and the server-side report in #2196. Updated onto main
5c8dd322528cc84f68f461ad54a506b9da8fa8d4(0.2.3).The newer image-start and tool-picture paths do not replace all of this elastic-start/idle-stop fix.
Draft: the common CI-stability prerequisite is #3590, by
justindressler, headacb05a7fe948204ed556a618de8d28063cd80c1d; also tracked in #3407.That PR fixes process identity in the portable watcher and a telemetry-sampler failure. It is still unmerged.
In line with CONTRIBUTING's one-problem-per-PR rule, its code is not bundled here:
serve/lifeline.py,serve/telemetry.py,serve/test_responses.pyand CI workflows are identical to main in this branch.The combination was tested separately below. Please land/review #3590 independently; after it lands I will merge the updated main and rerun the standalone checks before marking this PR ready.
This is a CI-stability prerequisite, not a new functional dependency of the HTTP 503 handler.
No retries, skips, weakened assertions or workflow changes are used to hide the watcher failure. One green test run does not fix it:
a controlled sleeping-to-running state transition still changes the old
ps lstart,statidentity on both main and this branch,so the watcher leaves its child alive after pipe EOF. With #3590 the identity is stable and the child ends;
the wrong-identity and explicit-release guards still preserve the child.
Approach
Use the existing
EngineDied/HTTP 503 path for an exception from the elastic encoder'srestart().Keep the success/retry path and cache behavior. The idle-stop log is outside the cache-grow condition.
Only server Python, vision regression tests and
docs/VRAM_ELASTIC.mdchange; no native backend, default or process-supervision changes.The new Linux regression starts a real temporary encoder program which exits with code 71.
For chat/messages/responses, streamed and non-streamed, and two attempts, it checks HTTP 503, a fresh child per attempt, and that each child is reaped (12 cases).
This is a real subprocess startup-failure test, not a CUDA allocation-failure test.
Validation: 2026-10-23
Exact submitted head:
d7059ebe0a43b5245b811757ccb3d7e8edcd74cf.Environment: Linux x86_64, Python 3.12.3, existing runtime-only dev venv, localhost fake-engine fixtures; GPUs hidden.
Dependency comparisons apply the unchanged #3590 patch only in separate dev trees (patch SHA-256
527ce611a6f32231e19e6809f16713e6b288e2ea63d7b8b245cbff98eea1d93c).No production service, config or binary was changed.
Passed
python -m unittest serve.test_vision_elastic serve.test_vision_elastic_http serve.test_vision_start_error serve.test_vision_tool_image serve.test_vision_token_limit serve.test_ready_timeout -v: 34 tests, no skips, exit 0.Full discovery with no test exclusions,
python -m unittest discover -s serve -p 'test_*.py' -v:5c8dd322+ #3590d7059ebealoned7059ebe+ #3590Recorded unittest times: 336.802 / 337.054 / 338.150 s respectively. These are validation durations, not performance benchmarks.
The same 26 skips are Anthropic SDK (3), pack tokenizer fixtures (5), jsonschema (3), Node not on the initial PATH (12), and Windows (3).
Replayed the 12 Node tests using the already installed Node runtime:
python -m unittest serve.test_web_api_key serve.test_web_sampling -v, 12/12, exit 0. No package installation.The CI smoke script,
python tools/minimal_server_smoke.py --report <new-absolute-report-path>, passes on the submitted head:43 passed, 4 skipped out of 47, exit 0, 108.104 s. The venv has numpy/jinja2/requests and no rich/textual.
The dev venv's unrelated editable gguf-py tree first shadowed the repository's
testsnamespace; the unchanged smoke script was rerun with only that import path removed through a process-localsitecustomize. Neither the venv nor repository code was changed for this isolation.Controlled S/R identity, EOF, wrong-identity and release checks on main, submitted head and submitted head + #3590; the first two reproduce the known bug and the last removes it.
git diff --check; submitted source stays clean. Its diff against main is limited to four vision/docs files.Failed / negative controls
d7059ebe, Python 3.11.17:the runtime-only smoke passed (43 passed / 4 skipped out of 47, 108.557 s). Full server discovery ran 979 tests in 339.807 s:
964 passed, 14 skipped, one failure, exactly
test_lifeline.Lifeline.test_the_portable_watcher_ends_the_child_when_the_server_is_killed(
the child outlived a killed server (watcher)). No other failure/error was reported. This matches the separately reproduced #3590 prerequisite;the vision regressions passed. The failed job is retained, not rerun, and this PR stays in draft.
de511d39remains historical evidence of the common watcher bug. Its deterministic reproduction still fails on the current main and submitted code; the successful standalone full-suite run above is not claimed to repair it.ModuleNotFoundError: tests.terminalon both unchanged main and the candidate. The source was not patched to work around the dev venv.Not run
Limits
This fixes the HTTP failure/retry path. It does not add per-stage elastic caches or make a layer split free VRAM for the encoder.
No duplicate #3590 implementation and no claim that its unmerged fix is already upstream.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.