Repository navigation
[PR] fix: cap x-bili-pf-tail-ids at 2 KiB so a lagging stamp can't overflow the header (#7212) - #7219
ranxianglei wants to merge 2 commits into
Conversation
…w the header The watermark channel's tail-ids header was unbounded: its width is (T - k + 1) ids, so when the learned stamp k lags far behind the current element count T (a side request with a smaller seq overwrites k), the encoded value grew past Node's 16 KiB maxHeaderSize. The parser then drops the connection, killing the whole session — and every retry re-sends the same oversized header, so it never recovers. pfRequestHeaders now byte-caps the encoded value at 2048; over the budget it drops the tail-ids header (count only). The proxy degrades to the legacy full-parse for that turn and re-stamps the true count, so the window self-heals next turn. Slower but correct — never dead. Closes #7212
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10877-pr.7219.794b551This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7219.tgz
npm install -g packageInstall instructions are refreshed on each push. |
… the real size The fixture generates 13-char ids (not 36-char uuid-shaped), so the 449-id window is ~6.5 KB, not 16.4 KB — it exceeds the 2 KiB cap this test pins but does NOT trip Node's 16 KiB maxHeaderSize. The production overflow was the same shape at a much wider lag (16+ KiB). Comment-only; no behavior change.
(ai: vllm-qwen/qwen3.8-27b) Duplicate screening: not a duplicate. #7219 is the sole fix PR for #7212. I searched open+closed issues/PRs for ReviewI pulled the PR branch ( Direction (①) — root-cause layer, correct. Node's HTTP parser drops the connection at the 16 KiB Regression (②) — existing behavior on the touched path:
Code (③) — correct. Tests (④) — the new regression test has teeth. k=2/T=450 pathological window asserts "tail-ids dropped, count kept"; a tight window (k≈T) asserts "full list kept"; it self-checks the fixture genuinely exceeds the cap. Targeted run locally: 16/16 green. Drive-by fix (1, commit CI / state: the PR is 29 commits behind master (no conflicts, 结构化八问
Verdict: mergeable (pending CI green on |
|
Closing as superseded by #7381. Both fix the same root cause (unbounded The one idea worth carrying over is the byte-based budget — if #7381's 160-id cap is tightened to also respect a byte limit, that piece transfers. Otherwise redundant. Reopen if you'd rather carry this one. |
What
#7212:
x-bili-pf-tail-idswas unbounded. Its width is(T - k + 1)ids, so when the learned stampklags far behind the current element countT(a side request with a smaller seq overwrotek), the encoded value grew past Node's 16 KiBmaxHeaderSize. The parser dropped the connection, killing the whole session — and every retry re-sent the same oversized header, so it never recovered.Fix
pfRequestHeaders(the single client-side chokepoint every lane funnels through) now byte-caps the encoded tail-ids value at 2048. Over the budget it drops thex-bili-pf-tail-idsheader and sends count only. The proxy degrades to the legacy full-parse for that turn and re-stamps the true count, so the window self-heals next turn. Slower but correct — never dead.This is the root-cause fix at the producer (the shim that builds the header), not a mask at the proxy: the Node parser kills the connection before any proxy code runs, so a proxy-side "warn and treat as miss" is unreachable, and raising
maxHeaderSizeonly pushes the cliff (the issue's own verdict).Behavior change (flagged per deliverables rule 4)
Tests
tests/pf-channel.test.ts: new regression test — a lagging stamp (k=2, T=450, 449-id window ≈ 16.4 KB) drops the tail-ids header but keeps the count; a tight window (k≈T) keeps the full list.Closes #7212