mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2886] [Engine] keep replica pipes and DONE statistics request-owned #4314
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#4314
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/2886
Author: @dynaxbill
Created: 10/17/2026
Status: 🔄 Open
Base:
main← Head:fix/replica-done-ownership-20261017📝 Commits (2)
f8527fafix(serve): keep replica pipes and DONE statistics request-ownedda681b7fix(serve): retain replica ownership on 0.2.0-beta📊 Changes
59 files changed (+9908 additions, -9 deletions)
View changed files
📝
.gitattributes(+5 -0)➕
docs/replica_request_lifetime.md(+232 -0)📝
serve/replicas.py(+21 -9)➕
serve/test_replica_lifetime.py(+435 -0)➕
tests/data/replica_lifetime/cases/slot-follow-SLOT-1-RVN-8020-fixed.sse(+34 -0)➕
tests/data/replica_lifetime/cases/slot-follow-SLOT-1-RVN-8020-original.sse(+6 -0)➕
tests/data/replica_lifetime/cases/slot-follow-SLOT-1-RVN-8020-request.json(+1 -0)➕
tests/data/replica_lifetime/cases/slot-follow-SLOT-3-RVN-23858-fixed.sse(+36 -0)➕
tests/data/replica_lifetime/cases/slot-follow-SLOT-3-RVN-23858-original.sse(+36 -0)➕
tests/data/replica_lifetime/cases/slot-follow-SLOT-3-RVN-23858-request.json(+1 -0)➕
tests/data/replica_lifetime/current-main-cpu.json(+125 -0)➕
tests/data/replica_lifetime/dependencies.json(+37 -0)➕
tests/data/replica_lifetime/gpu-historical-cases.json(+133 -0)➕
tests/data/replica_lifetime/gpu-qualification.json(+5378 -0)➕
tests/data/replica_lifetime/linux-close_only.log(+39 -0)➕
tests/data/replica_lifetime/linux-controls.json(+44 -0)➕
tests/data/replica_lifetime/linux-fixed.log(+23 -0)➕
tests/data/replica_lifetime/linux-original.log(+220 -0)➕
tests/data/replica_lifetime/manifest.json(+270 -0)➕
tests/data/replica_lifetime/offline-alternatives-microbench.json(+303 -0)...and 39 more files
📄 Description
Problem and result
Unbatched replicas can release their native pipe before an early-closed child drains DONE, so a successor can receive the previous reply's DONE or tokens. Even after a correct drain, shared native last statistics can be overwritten after unlock. Release 0.2.0-beta still reproduces both failures. Keep the existing per-replica lock through child cleanup, snapshot the caller's new DONE before unlock, and retain its pre-DONE identity when no new result arrived.
Related discussion
Fixes #2892. Updated in the original thread after the 0.2.0-beta tracker reset. This is the same focused serving fix, not a new proposal or default change.
Approach
Scheme A: explicit child close/drain plus a caller-local DONE snapshot, preserving independent replicas, cleanup-error propagation, router/nonfinite bookkeeping, embeddings and batched paths. The refreshed code retains upstream's
_strata_replica_selectedcallback and the official callback/telemetry tests pass. No server.py/native kernel, protocol, routing-cost, sampling/default or CUDA Graph changes; no new queue, worker, sleep or retry.The feature branch integrates main
f57c0adcb31c00f3f216550c004dac4e713a9f70while preserving the earlier PR history. The replayer defaults to the fixed 0.2.0-beta revision. Its close-only negative control now requires the two forced statistics failures, allows only the additional multi-caller statistics failure, rejects errors, and keeps all 18 fixed contracts mandatory. This records15/18 versus16/18 variability without retrying to pick a count or weakening the fix gate.Validation
Passed: Windows CPython 3.12.14, pinned Jinja2/regex/MarkupSafe, main
f57c0adcb31c00f3f216550c004dac4e713a9f70+ A; unchanged server.py.python -m unittest -vrun separately forserve.test_replica_lifetime(18),serve.test_replicas(19),serve.test_parallel(42),serve.test_request_accounting(10),serve.test_request_hardening(10),serve.test_queue_keepalive(3): 102/102.python tools/replay_replica_lifetime.py --output <new-dir> --baseline-file <captured-release-replicas.py>: official 9/18, close-only 16/18, A 18/18; control statusPASS. Baseline release is3d1fb48090e8f2cefc22d7b5845fb7f5b71f33fa; a Git checkout can omit baseline-file because that is now the default revision.Failed: official/close-only controls deliberately reproduce ownership bugs. Earlier close-only15/18 raw is preserved. Initial local setup omitted strata_cli, then regex; the unmodified runtime module and pinned dependency resolved imports, without product/test assertion changes. Logs included.
Not run: GPU/model execution of 0.2.0-beta / engine 0.1.45.3, native CUDA/HIP/SYCL/Metal builds, new performance or full-model KL/perplexity/long-soak qualification. No native source changed. Published engine 0.1.44.1 GPU runs remain historical and are not relabelled as this revision.
Evidence: new release replay, commands and selected tests, historical roots/three repair alternatives/GPU evidence, per-file manifest.
Limits
New runs use the actual Python reader/pump with synthetic native producers (two contracts use real OS pipes), plus HTTP fake engines. They establish the forced ownership failures and the bounded repair, not GPU hardware correctness, universal output quality, empty-reply probability or performance. The two roots chiefly concern unbatched replica handoff; this is not a claim that every batched C4 call fails. Historical GPU data, synthetic request/SSE bytes and their original versions remain unchanged.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.