Repository navigation
[PR] fix(#4977): exit twin-collision before persistence init when the port holder is a silent same-build twin - #5004
Conversation
… holder is a silent same-build twin
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.7429-pr.5004.3619bb7This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5004.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 检索 open+closed 的 issue/PR,无其他在途工作修同一残留缺陷。相邻条目机制各自独立且各有归宿:主链(并发重拉全体放弃)已由 #4825 合入、直连窗口守卫由 #4904 合入(均晚于报障版本 v0.1.208),DIGEST DRIFT 处置由 #4986 单独跟踪——本 PR 只针对「替补子进程在僵尸底下先开 index.db」这一个残留点,与它们无重叠。 标签: 以下结论是我对本 PR 分支(c820c8b,单提交、直接落在当前 master 9b6ec23 上)独立重审的结果,不是转述 #4977 侧的分析: 一、方向关(审原 issue):#4977 的可执行项里,master 上真正剩下的就是这一处——子进程的前置裁决只认「探针有应答且身份匹配」的孪生(#4341 verified-adopt),占据者是「socket 还通、探针沉默」的将死态时判定不命中,进程就一路走到持久化初始化才在 listen 处撞 EADDRINUSE。本 PR 修的正是这个点,没有扩大也没有缩小范围。issue 建议里的其余各项(spawner 重试仲裁、BUSY 判定接入 respawn、直发窗口守卫)分别由 #4811/#4825、#4894/#4904 承接,DIGEST DRIFT 归 #4986——分工干净。 二、八问
三、测试有效性:真测试。两行真实 CLI 子进程的断言有牙且互为对照——僵尸占端口行断言 exit 3 + 两条 hint + 四、本地定向验证: 五、CI 状态:截至我查看时(fetched 19:15Z)各 test 分片 in_progress/queued,尚无失败;mergeable_state=blocked 仅因检查未完成。 合并判定:代码与行为审查通过,无拦截项;等 CI 全绿即可由 owner 合入(合并动作本身我只提示、不代劳)。 |
The silent-twin zombie server accepted TCP connections without an error handler on the sockets. On Windows the child's abrupt process.exit resets the half-open probed connection; the RST reaches the zombie-side socket after the test has already completed and surfaces as an uncaughtException (read ECONNRESET) failing the shard although every assertion passed (CI run 40567102989, test (windows-latest, 22, 2), not ok 852). Matches the established pattern in the fix-806 / auto-restart / port-zone-live suites.
Unblocks PR #5004's test (windows-latest, 22, 2) red on head da25207: three abort cells (proxy-openai-sse / proxy-responses-sse / proxy-json) asserted closed=0 after exhausting the flat 3s (30x100ms) poll on a loaded Windows runner -- the same signature already recorded under #4599 for #4982/#4774/#4683 (rerun green / in-branch budget bump). Sibling cell abort x proxy-anthropic-sse passed in 176ms on the same shard and every other windows/ubuntu shard ran this file green on the same head, so this is runner load, not a code regression; the PR's diff touches none of these paths. Labeled CI-unblock commit; duplicates #4683's pending identical change -- drop this commit when rebasing if #4683 lands first.
(ai: vllm-qwen/qwen3.8-27b) CI 续报(新 head
当前判定:产品代码自 |
(ai: vllm-qwen/qwen3.8-27b) CI auto-fix attempt 2/2 收工:根因已定位、修复已推送,等重跑 查重:无重复 issue/PR——但此红属于 #4599 在档的已知 flake 家族(floors 350/352/358:#4982/#4774/#4683 今日同签名命中);修法与 #4683 分支上未合入的预算加倍相同(#4683 先合则 rebase 时丢弃本 commit),不另开 issue。 八问
行为变更披露(仅测试):四个 abort cell 的断言等待上限 3s→6s——只影响慢 runner 上失败出现的时点,不放松任何断言(预算耗尽仍立即失败,不会吞掉真回归)。 结论:等 |
(ai: vllm-qwen/qwen3.8-27b) CI 收口:全绿 ✅(最终 head 时间线(全部已逐份读日志核实,非转述):
最终判定:产品代码自 |
|
(ai: vllm-qwen/qwen3.8-27b) Merge-guard outcome: textual conflict resolved locally and verified — but the merge exposes a design contradiction with already-merged #5016, so nothing is pushed until #5018 is decided.
|
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Merge-guard round 5 — 重新同步 master,状态不变,仍等 #5018 拍板。 做了什么:master 又前进(dcf7607 → 44067a5,+14 提交)。已把当前 master 合进本分支——零冲突,本地新合并头 这 14 个提交全部落在存储/旁路/快照域(#5188 sidecar 可恢复打开、#5140 sqlite 竞争不锁死 sidecar、docs/config 登记 sessions.hardMaxBytes),与本 PR 触碰的文件(src/server.ts 启动/twin-block、src/instance.ts、src/port-owner.ts、src/listen-policy.ts、tests/issue4977*、tests/issue4982*)零重叠。 八问(本轮为再同步轮,多数项「不变」):
收工判定:停手等 #5018 裁决(A/B/C,已挂起约两天,决策面自 round-4 起无变化,本轮这 14 个提交也不涉及决策域)。拍板后恢复动作 = 一次 push |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Merge-guard round 6 — no-op:master 未动,决策仍未定,无需 rebase/merge。
|
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Round 7 — 仍是 no-op;顺带说明刚才那次「卡住被强制重启」。 先澄清:刚才「进程卡住 31 分钟被强制重启」不是真挂起——round 6 我已把能做的做完(核对 master、确认无需合并、贴状态),之后会话在等你对 #5018 拍板,daemon 把这段空闲误判成卡死回收了。不是需要规避的故障。 本轮核对(与 round 6 完全一致):
一句话:在你对 #5018 拍板(A 早路径胜 / B 晚路径胜 / C socket 属主门)之前,这个 PR 无法推进,每次 guard 触发都会是同类 no-op。拍板后恢复动作不变 = 一次 push |
# Conflicts: # scripts/live-files.mjs # src/server.ts
[ework] CI fix verified green ✓ |
1 similar comment
[ework] CI fix verified green ✓ |
…rsistence adopt-exit (option A) Ruling (owner-approved 2026-10-31): for an unverified unstamped same-lane claim the early pre-persistence gate (#4977) wins over #5016's late ladder. The second row of tests/issue4982-draining-twin-ladder.test.ts now asserts the code-3 twin-collision adopt-exit BEFORE index.db is opened instead of ladder-off; the draining (portReleasedAt-stamped) row keeps asserting the ladder. Fixture cleanup hygiene was already finally-wrapped upstream, nothing to add. Refs #5018 #5004 #4982 #5016
|
(ai: sglang-gpu0/qwen3.8-27b) Branch updated per the #5018 ruling — option A (owner-approved 2026-10-31) — plus a rebase onto current master. What changed on this head:
Local targets green on this head: issue4982 suite 7/7, issue4977-present-twin + wire-exit-matrix + auto-restart 29/29, typecheck clean. Full-suite verdict below from CI. The fixture cleanup hygiene flagged during triage was already finally-wrapped upstream in this file — no extra commit needed. |
# Conflicts: # src/server.ts
[ework] CI fix verified green ✓ |
|
(ai: sglang-gpu0/qwen3.8-27b) Conflict with #5303 (upward adoption, merged to master as fb5b916 while this PR was in flight) resolved: the only clash was the instance.js import line in src/server.ts — kept both symbol sets minus entryScriptFingerprint (superseded by resolveOwnFingerprint per #4125). The two new-holder policies coexist by design: our early gate handles SAME-build twins (verified→adopt-exit, unverified-silent→pre-persistence exit), #5303 handles strictly NEWER builds (positive registry+health proof → adoption at bind time). Local on this head: typecheck clean; issue4982 / issue4977 / wire-exit-matrix / auto-restart / issue4125-giveup-reason / issue4125-two-install-deadlock = 51/51 pass. Full gate via CI below. |
[ework] CI fix verified green ✓ |
ranxianglei
left a comment
There was a problem hiding this comment.
审查完成(本地分支 @980f7aa7,已核对 src 全量 diff + 门控/e2e 套件 + tsc)。结论:代码通过,无阻塞项;CI 全绿即可人工合并。
逐项核验:
- gate 位置与互补性(src/server.ts startServer):插在既有 verified-adopt gate 之后、
createEngineContext(持久化初始化)之前,与 body 声明逐字一致。verified gate 只收「probe 有回应且匹配」的 twin;本 PR 的 present gate 只收「probe 静默但 socket accept」的 twin——两者互斥覆盖 #4977 的两个窗口,无重叠判定、无遗漏。✓ - 正向证据纪律未被破坏:findPresentUnverifiedSameLaneTwin 的顺序是 classify(kind!=="twin" 跳过) →
socketAlive先行做 decisive negative(无活监听 = stale marker,继续 bind,#4341 原则原样保留)→ probe 静默才返回。stale registry entry + 空闲端口 = 正常启动不受影响(有测试钉)。✓ - 结果等价性:若两次 probe 之间 twin 复活并应答,gate 落空 → 走旧 late-EADDRINUSE 策略,拿到的 registry 证据与旧路径相同 ⇒ 同 code 3(
eaddrinuseExitCode("twin-collision")),spawner 侧 #4811 self-heal adopt 语义不变。最坏情况=旧行为,无新增伤害。exitBeforePersistence 共享尾部两路复用同一 tail(configureLogger→error→spawn-port-log→drain closeLogger→process.exit),launchToken 分支也一致。✓ - #4982 e2e retarget 正确(125c3bc5):按 #5018 owner ruling(option A)把 unverified-twin 行从「drain 阶梯」改锚到 pre-persistence adopt-exit,断言链完整:exit code=TWIN_ADOPT_EXIT_CODE、stderr 含 "still held by a same-build bili instance (pid \d+, lane pi) whose health probe is silent"、bili.log doesNotMatch 旧 verified 文案、sessions/index.db 不存在(#3923/#3959 双写窗回归钉)。本地实跑通过。顺带说明:这一行正是当前 master 上一直红的 "#4982 draining same-lane predecessor + squatter" e2e——本 PR 合入会直接消除 master 那条已知红(此前多个 PR 的 CI 分诊都把它归为 master 既有失败)。
- auto-restart 变更(216f3a5c):makeReadyStub 的 EACCES/EPERM 并入 OS-bind-refusal 类(Windows dynamic exclusion ranges,#3182 族)与 misplacement-stub 重试语义对齐,属必要配套而非夹带。✓
- wire-exit-matrix(231f77a1/da252074):ABORT_TEARDOWN_BUDGET_MS 3s→6s(loaded Windows runner flake)+ issue4977 real-CLI 行吞 zombie-socket 错误,均为有据的稳定性加固。✓
非阻塞备注(无需改动也可合并):
- CHANGELOG:近期合入(如 #5236/#4521 merge bcl87837)都带条目,本 PR 没有 CHANGELOG.md 行。看 maintainer 是否要求补一句「silent same-lane twin now exits before persistence (closes #4977)」。
- body 里 "second-writer / cross-lane squatter" 边界声明与实现一致:classifySameLanePeer kind!=="twin" 直接跳过,跨 lane 占用完全不进本 gate。
本地验证(正式全量留给远程 CI,head 轮刚入队 pending,不盯):
- 定向批全绿:issue4977-present-twin-persist-gate 23/23 + 其余 7 文件 61/61(issue4982-draining-twin-ladder、wire-exit-matrix、auto-restart、issue4341-early-twin-adoption、issue3654-health-probe-three-state、listen-policy、issue4125-two-install-deadlock),0 fail 0 skip
tsc --noEmitexit 0- 无 kernel 改动 ⇒ 不触发 kernel-guard、无需版本 bump ✓
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Option A 已落地并同步到最新 master——本轮做了独立验证 + 守卫同步 + 推送。 背景:#5018 已由你拍板 option A(2026-10-31),实现会话据此把冲突测试行改钉为持久化前 adopt-exit(commit 本轮(merge-guard)做了什么:
八问:
收工判定:分支已同步到最新 master 并推送( |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.944-master.7528deb # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #4977
What this fixes
The residual defect from #4977's incident chain (the main availability chain was already fixed in #4825/#4904, both post-v0.1.208): when the port is held by a same-build, same-lane twin whose health probe is silent while its socket still accepts connections (dying or event-loop-wedged — #3654's alive-but-unserviceable), a substitute child proceeded into persistence initialization and opened
index.dbunder the zombie before its own listen failed EADDRINUSE. Every recovery-storm round produced a real two-process window on one store (#3923/#3959) plus the misleading[storage] another process … is already writingreport — on rounds that end in the twin-collision exit anyway.How
findPresentUnverifiedSameLaneTwin(src/instance.ts) — the recovery-window complement tofindVerifiedSameLaneTwin. Per registry entry, in order: same-lane twin classification → socket accepts (decisive negative: no live listener means a stale marker, fall through to the bind) → health probe silent (an answered probe falls through to the verified/mismatch path).createEngineContext, a present-but-silent twin exits via the sharedexitBeforePersistencetail with the identical code 3 (eaddrinuseExitCode("twin-collision")) the late EADDRINUSE path would have produced: the late policy classifies exactly this registry evidence (classifySameLanePeer→twinHoldsfail-fast), so the outcome is unchanged, only decided earlier — without touching the store. The spawner reads code 3 as an adopt signal and retries once the zombie frees the port (dsh lane: BUSY-drop → EADDRINUSE detour → adopt-twin race is silently lost ~half the time, and a one-shot bootstrap failure then becomes permanent #4811 self-heal).Behavior change disclosure
index.db(+ lockfile overwrite) and then exited code 3 now exits code 3 without opening the store. No change to any outcome that reaches serve state.still held by a same-build bili instance … health probe is silent); spawn-port log format unchanged.Config surface
None added — reuses existing knobs only (
probeOwnerInfo/tcpConnectabledefaults).Tests