Repository navigation
misc: format - #741
Merged
Merged
misc: format#741
Conversation
timethink
pushed a commit
to timethink/sglang
that referenced
this pull request
Mar 9, 2025
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 17, 2026
…s what the watchdog polls Root for the family isolated in ANALYSE_734 (S2 CUDA illegal memory access 2026-08-17; S3 Bar1CollectiveAborted 2026-08-05, different model, tp3/pp1). THE DEFECT. barlink_bar1.py Bar1Transport.close() (:5563) releases the device memory the watchdog is still polling and disarms the watchdog FOURTEEN LINES LATER: :5643 self._cuda.vmm_free(*w) <- memory released :5646 self._ctl_dev = None :5657 self._abort_poll_active = False <- watchdog disarmed The code's own comment two lines above the disarm states the correct intent -- "the watchdog poll ... reads _ctl_dev directly -- it has to stand down with the word". It does not stand down WITH the word, it stands down AFTER it. The watchdog runs on its own thread (poll_status_word, :4807), takes no lock, and is not joined before the free. ONE DEFECT, TWO PRESENTATIONS, chosen by the allocator rather than by anything in the failure: - block unmapped -> the poll faults -> CUDA illegal memory access (S2) - block recycled -> the poll reads garbage -> non-zero status word and the second arm closes because THE ABORT CODE IS NEVER VALIDATED: there is no known-code table anywhere in the module, so check_aborted raises "a spin kernel took its abort path" for any non-zero word. S3 therefore reports a spin-kernel abort that no spin kernel performed. That is the unification. WHY THE LOG ORDERING DOES NOT INCRIMINATE THE POLL, now by mechanism rather than caution: barlink_abort_gate.poll_status_words() (:327) swallows the fault under "except Exception # a watchdog must not die". A CUDA IMA is STICKY -- it poisons the context, so every later CUDA call re-raises it. The gate keeps polling and re-reports the same fault, which is exactly S2's "four repeated" errors, and the serving path only learns of it at its next CUDA touch, which happened to be the kv_reshard checksum. Gate = first reporter, payload path = second reporter, neither is the perpetrator. Same reporter-vs-perpetrator shape as sgl-project#722, recurring one layer down. THREE CONDITIONS keep it alive independently, and one of them widens the verdict's reach: there is NO record_stream() anywhere in the module (searched, zero hits), while the poll copies from _ctl_dev on a PRIVATE stream with non_blocking=True. That is the documented caching-allocator hazard on its own, so the family does not strictly require a close() -- a plain recycle under memory churn suffices. Which is consistent with S3 happening on a boot with no phase flip at all. Also: pause_polling() exists but has exactly ONE real caller (parallel_state.py:2888, for graph capture, and its docstring says why); teardown and arena remap never got the same treatment despite the same cross-thread hazard. WHY S2 SURFACED ON THE FLIP PATH: its server_args read tp_size=1, pp_size=3 with enable_phase_flip=True and phase_flip_tp_vector='32,16,16'. At tp_size=1 there is no steady-state TP collective for barlink to serve -- the transport exists in that boot FOR THE FLIP's TP layout, so the flip is what builds and tears these down while the server is live. FIX SHAPE filed (5.1 disarm-then-quiesce before free; 5.2 atomic guard; 5.3 record_stream, required for the S3 arm; 5.4 pause across flip teardown reusing the existing context manager; 5.5 narrow the gate's except so a sticky CUDA error is not swallowed; 5.6 validate the abort code so garbage becomes a named refusal instead of a false accusation). Not built in this commit. Open and named: lineage (which commit each specimen ran, sgl-project#634's exact closure and reopen wording, sgl-project#717/sgl-project#722 dates) is being pulled separately and the sgl-project#634 reopen decision is NOT made here; and I have not traced the flip's call into close() line by line -- the ordering defect stands on its own reading and condition 2 means the family does not depend on that link, but the S2 attribution does. No boot; source and the two logs only.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 17, 2026
…flip, and sgl-project#722/sgl-project#634 stay closed I reproduced a RETRACTED verdict. My previous commit (1b6b989) rooted the barlink-BAR1 family in a teardown-ordering race in Bar1Transport.close(). That is task sgl-project#722, which was already filed with the same mechanism -- OPERATOR-STATE :9053-9057 records it almost word for word ("poll_status_word liest stale _ctl_dev-Mapping ... Guard prueft is-None = IDENTITAET statt VALIDITAET") -- and then RETRACTED on live evidence: the abort-poll is REPORTER not perpetrator, the real root was sgl-project#717's backing mismatch, and the revert was proven over 216+33 flips with 0 faults. WHY I MISSED IT: I gated the prior-art search on the repository. Both sgl-project#722 and sgl-project#634 live in OPERATOR-STATE.md, outside it. The subagent's "NOT FOUND in the repo" was correct and the repo was the wrong place to look. The gate is only as wide as the corpus you point it at, and I pointed it at one. THE REAL ROOT, from S2's own log: 48743 19:30:31 PHASE-FLIP armed: pp_to_tp 48749 19:30:31 FLIP EXTENT PROBE: seqlen=51311 kv_allocated_len=51310 48740 19:30:31 CENSUS at-arm: cached=127182 cur_slot_reqs=4, backing=309464, highest live row=183998 48931 19:30:40 KV-BACKING EVICTED 127731 recomputable rows to bring the high-water mark below 61303 (resident ceiling -1) 48935 19:30:40 backing 61303 instead of 116736, highest live row 0 48955 19:30:4x CUDA illegal memory access Twenty-four lines from eviction to fault. _nothing_resident() returns True when _last_live_split["req_rows"] == 0. During a pp_to_tp flip the requests are PARKED for the consensus round, so req_rows reads 0 while 127182 rows are still cached and the flip's own probe has just measured a request at seqlen=51311. The rung takes the nothing-resident branch, evicts 127731 rows, shrinks backing 309464 -> 61303 -- and the flip then reads the rows it was about to move (phase_flip_runtime:6926 _execute -> _pack_outgoing -> kv_reshard.py:359 _checksum). Those rows are above the new cap. THE SAFETY NET CANNOT COVER THIS BY CONSTRUCTION. Site A's comment says the optimistic pricing "is only safe BECAUSE" _shrink_to re-reads the live set afterwards. It re-reads the live REQUEST set, and the flip's pending pack is not a live request -- it is parked, which is the very state that made req_rows zero. Check and hazard share one blind spot. This is b786858's revert text ("backing shrank to 69,054 rows under a highest live row of 233,289, and the next access above the cap was an illegal address") recurring through the REBUILD 675793c, on a path the rebuild did not consider: not a live request above the cap, but the phase flip. LINEAGE, by git merge-base --is-ancestor against serving commit 9255258: c4e5579 (attempt), b786858 (revert) AND 675793c (rebuild) are all IN. So S2 is post-revert AND post-rebuild -- and that distinction is the answer. Post-revert alone would suggest a barlink reopen; post-rebuild says the reverted defect returned through its own replacement. S3 (2026-08-05) predates sgl-project#622 (08-08) and sgl-project#717 (08-17) entirely: old world, not a trigger. VERDICT: sgl-project#722 and sgl-project#634 do NOT reopen. The trigger is a new post-revert specimen with a BARLINK perpetrator; S2's perpetrator is the KV rung and the abort-poll is again the reporter -- so this note is a second independent confirmation of sgl-project#722's retraction, not a challenge to it. sgl-project#741 reclassifies as a sgl-project#717-rebuild x phase-flip regression: live, rooted, unowned. The barlink stand-down/re-arm change stays UNBUILT per the standing order; my section 5 is superseded. Fix shape for the real root (not built, three options with a preference): make the flip's pending extent visible to the split so req_rows counts parked-for-flip rows (preferred, smallest, closest to the defect); or gate the rung off while a flip is armed (blunt, costs the idle-box win, cannot be wrong); or extend _shrink_to's re-read to the flip's pending set so the net covers what its comment claims. Sections 1-4 of the note are KEPT, marked retracted, as the record of what was claimed and why it is wrong.
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Aug 17, 2026
…tem was its interaction with sgl-project#744 PRIOR-ART GATE OUTCOME: sgl-project#731 is not open. The fix is fdcf837, authored by F4-r4 2026-08-17 15:42, and it is ALREADY AN ANCESTOR of this branch. The ledger says so too ("sgl-project#731-Fix war schon gepusht fdcf837"). All three parts of the briefed fix shape plus the extra pin I was asked to add are present: 1. STATE -- _consume_carried_from_waiting_queue, carry consumes the entry 2. NUMBER -- _pending_prefill_tokens de-duplicates at the INTERSECTION (deliberately not a blanket per-rid dedup) 3. GUARD -- duplicate_resident_reqs gains waiting_queue, queue-side hits carry a `queued:` prefix so the 2026-08-09 resident-vs-resident specimen stays distinguishable plus -- _arriving_prefill_tokens' asserted-never-enforced invariant is now actually checked (Term 3, the hardening I was told to pin) Building it again would have duplicated merged work. This is the second time this week the gate paid for itself, and the same lesson as sgl-project#741: the corpus includes the ledger. WHAT WAS GENUINELY OPEN is the item the brief flagged and nobody had checked: after sgl-project#744 a carried request's rows reach the KV rung through the parked extent, so does sgl-project#731's consume change what _flip_pending enumerates? If it did, sgl-project#731 would have silently narrowed sgl-project#744's protection and re-opened the illegal-access window from the other side -- and neither suite would have caught it, because each pins only its own half. VERDICT: it does not, and for a structural reason rather than luck. _live_reqs enumerates running_mbs, running_batch, last_batch and chunked_req. It has never read waiting_queue. The carry ADDS the request to running_mbs[0], which IS enumerated, so the carried request's rows reach the parked extent through the resident side both before and after the consume. Before sgl-project#731 it sat in both sets and the enumeration deduplicated by identity; after sgl-project#731 it sits in one. Either way it contributes its rows exactly once. Pinned rather than left as a paragraph, because the next person to touch either enumeration or the carry needs it to fail if they break it. TEST RESULTS New test_carry_parked_extent_interaction_731_744.py, 5 tests, all green: - the extent is identical before and after the consume, driven through sgl-project#731's OWN helper rather than a hand-built after-state; - a CAN-FAIL guard first: the carried request must actually contribute its 51311 rows, otherwise the comparison would pass while proving nothing; - the converse (a queue-only request contributes nothing, which is WHY the consume is safe); - a structural pin, AST-parsed not grepped, that _live_reqs reads no queue -- it fails where the reason is written down rather than somewhere far away. Mutation proof, both KILLED: I1 _live_reqs also reads waiting_queue -> 2 failed (the forbidden interaction) I2 sticky extent never recorded -> 1 failed (the sgl-project#744 side of the pin) Pinned suites all green together, 125 passed + 8 subtests: test_carry_queue_duplication_731, test_evict_rung_flip_park_744, test_evict_rung_nothing_resident_717, test_evict_rung_floor_invariant_717, test_kv_backing_cap_agreement_656, test_kv_backing_recovery_clamp_684, test_kv_backing_exhaustion_662_f4, test_admission_intake_713. No production code changed in this commit -- a test file and a doc rename -- so the managers baseline is untouched by construction. Ruff and codespell clean. Also renames TICKET_745 -> TICKET_746: my sgl-project#744 follow-up filing collided with register-sgl-project#745 (GDN checkpoints). The file now carries a line naming register sgl-project#746 and stating that nothing in it relates to GDN, so the two cannot be merged by a later reader.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for your contribution, we really appreciate it. The following instructions will help improve your pull request and make it easier to receive feedback. If there are any items you don't understand, don't worry. Just submit the pull request and ask the maintainers for help.
Motivation
Please explain the motivation behind this PR and the goal you aim to achieve with it.
Modification
Briefly describe the changes made in this PR.
Checklist
pre-commit run --all-filesor other linting tools are used to fix potential lint issues.