Skip to content

chore: add close inactive issues workflow - #722

Merged
zhyncs merged 2 commits into
sgl-project:mainfrom
zhyncs:close
Jul 25, 2024
Merged

zhyncs merged 2 commits into
sgl-project:mainfrom
zhyncs:close

Conversation

@zhyncs

@zhyncs zhyncs commented Jul 25, 2024

Copy link
Copy Markdown
Contributor

Motivation

When an issue has not been updated for more than a month, mark it as inactive and close it.

cc @merrymercy @Ying1123 @hnyls2002

I have tested it in my personal repository and there were no problems, but I am not sure if the repositories under the organization are also ok.

Modification

add GitHub workflow

Checklist

  1. Ensure pre-commit pre-commit run --all-files or other linting tools are used to fix potential lint issues.
  2. Confirm that modifications are covered by complete unit tests. If not, please add more unit tests for correctness.
  3. Modify documentation as needed, such as docstrings or example tutorials.

@zhyncs

zhyncs commented Jul 25, 2024

Copy link
Copy Markdown
Contributor Author

@zhyncs
zhyncs requested a review from Ying1123 July 25, 2024 06:27
@zhyncs
zhyncs merged commit 6e45394 into sgl-project:main Jul 25, 2024
@zhyncs
zhyncs deleted the close branch July 25, 2024 06:31
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
cherryblo added a commit to cherryblo/sglang-project that referenced this pull request Jul 2, 2026
…mp-metric

fix: support dump_metric for multi-node e2e tests
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…oes (gated, red-first)

THE ABORT IS THE EXIT, not the work. "terminate called without an active
exception" after a CLEAN drain is the precise signature of a std::thread
destructor running while the thread is still joinable -- "without an active
exception" rules out the throw-in-thread variant.

ROOT CANDIDATE 1, provable by inspection and indicted by torch itself:
* distributed/parallel_state.py:3835 defines destroy_distributed_environment
  and :3845 defines cleanup_dist_env_and_memory. Across ALL of
  python/sglang/srt, NEITHER HAS A SINGLE CALLER (the only callers in the tree
  are in the unrelated multimodal_gen subtree, which has its own copy).
* torch reports the omission in the specimen itself: "ProcessGroupNCCL.cpp:1575
  WARNING: destroy_process_group() was not called before program exit".
* ProcessGroupNCCL's watchdog and HeartbeatMonitor are C++ threads joined by
  the group's DESTRUCTOR -- and HeartbeatMonitor::runLoop() appears BY NAME in
  specimens 2 and 3.
* The scheduler's graceful teardown (scheduler.py finally) runs
  close_regime_trace -> _shutdown_fpm -> release_host_resources and returns.
  No distributed teardown anywhere.
So at exit the groups are alive, their threads joinable, and whichever
destructor runs first calls std::terminate. That explains every property of the
family: after a clean drain, no active exception, no Python frame (C++, and in
specimens 2-3 the Python main thread is provably asleep elsewhere), chronic
across boots (unconditional), intermittent per process (which destructor wins).

FIX: managers/scheduler_teardown.py release_distributed(), called from the
finally in run_scheduler_process. Graceful path ONLY (destroying a group
synchronises; on the exception path the GPU may be wedged and a teardown that
HANGS is worse than the abort it prevents, which at least ends the process --
the same guard release_host_resources already carries), never raises (it runs
in a finally during shutdown, where raising would replace a clean exit with a
traceback or mask the original failure), idempotent.

DEFAULT OFF, and not out of timidity: GroupCoordinator.destroy
(parallel_state.py:2501-2508) closes barlink_comm BEFORE destroying the groups,
and barlink owns a POSIX shm segment plus the device-mapped abort word that
spinning kernels read (barlink_liveness.py:383,449). That is sgl-project#722's live
machinery in another lane. No barlink file was touched; arming this changes
WHEN that memory is unlinked relative to those kernels, so the lane that owns
barlink decides when to arm it. REPORTED AS AN OVERLAP, not edited.

Red-first: test/registered/unit/managers/test_scheduler_teardown_673.py (10)
pins that the teardown runs when armed, in the right ORDER (model-parallel
before the world, since the former is built on the latter), never on the
exception path, never by default, never raises, attempts both destroys even
when the first fails, and reports what succeeded. TestTheOmissionIsReal fails
if anyone ever adds a caller for cleanup_dist_env_and_memory -- i.e. it tells
the next reader that sgl-project#673's premise moved and the default should be revisited.

A test-construction bug of my own, found by running: the first version patched
sys.modules only, but `from sglang.srt.distributed import parallel_state`
resolves the package ATTRIBUTE, so the REAL destroy ran inside the test process
and quietly succeeded. Both are patched now, so the test cannot pass by
accident.

DIAGNOSIS: evidence-665-f1/DIAG_673_TEARDOWN_ABORT.md continued in place (the
qwen lane's three specimens are intact above the continuation). It now carries
the specimen reading, both root candidates, the completed background-thread
inventory, the revised ranking, and the explicit statement that this fix
addresses candidate 1 ONLY -- four other never-stopped C++-bodied threads are
named with their file:line and left to their owners, deliberately, so that a
live A/B of this flag points at one remaining hypothesis rather than five.

Regression, same env: unit/managers 4 failed / 2145 passed -> 4 failed / 2155
passed (+10, the new file); scheduler/test_phase_flip_runtime.py 67 passed.
scheduler.py diff: 11 insertions, 0 deletions.

Live check when a window opens (boot-gated, one boot): arm the flag and grep
the shutdown for the abort and for the "destroy_process_group() was not called"
warning. Both should disappear together.

CAN-FAIL PROOF (mutation applied, suite re-run, reverted):
  U1  the teardown never runs (fix removed)
      -> 5 failures incl. test_the_graceful_path_destroys_the_groups
  U2  the graceful guard removed (would run on the exception path)
      -> test_the_exception_path_never_destroys, and ONLY that one
  U3  the gate removed (would run by default, colliding with sgl-project#722)
      -> test_off_by_default, test_a_scheduler_without_server_args_is_a_no_op
  U4  destroy order swapped (world torn down before model-parallel)
      -> test_model_parallel_is_destroyed_before_the_world, +2
  U5  a failing destroy escapes the finally
      -> test_a_failing_destroy_never_raises,
         test_a_partial_failure_still_reports_what_succeeded
Restored tree re-verified green after every mutation (10 passed).
efschu added a commit to efschu/htsglang that referenced this pull request Aug 17, 2026
…d conflict map

PREPARATION ONLY. No branch pointer was moved and nothing was merged. Every
conflict is MEASURED by trial merges in a throwaway worktree
(throwaway/merge-train-probe, removed after measurement), not predicted.

Built from git rather than from the handed list, and git contradicted the list
twice:
* fix/713-admission-intake is ALREADY in the serving line (+0 commits, 0
  files) -- not a train item, and scheduling it would be a no-op step that
  looks like progress.
* fix/728-max-bytes-uniform points at 79216e6, byte-identical to
  feat/706-phase-uniform-hicache-keys, and has NO REMOTE. It must not be
  merged as a separate item, and its identity has to be settled first: a
  local-only branch is the one kind that disappears with its worktree.

DIVERGENCE. The 4222976 class turned out not to be the risk it looked like:
that commit is PRESENT in integration/r2 and absent only from upstream main,
which is true of every fork commit. The useful axis is the merge target -- 167
commits are on the serving line and not in integration/r2, and exactly SIX of
them are on no other train branch (the sgl-project#677 range c4bc982..5fed8a6, sgl-project#708
fc6f97b, and the merge 761d0d7). All six are reachable from
feat/677-park-wiring, so that branch carries them; if any step drops or
rewrites it, those six are the loss. The serving line is also NOT an orphaned
detached head -- 5fed8a6 is exactly feat/677-park-wiring, checked, because
unbranched commits on a serving head are how a train loses a fix.

ORDER. All eleven candidates are independent siblings (a containment check
found no branch containing another), so order is a conflict question. The
measured result is two clusters and a clean set:
* Cluster A, scheduler_teardown.py: all four sgl-project#673 thread-stop branches add
  their stop logic to the same file this lane created for sgl-project#673. They conflict
  with EACH OTHER, not with the trunk, so whichever lands first sets the file's
  shape. The barlink one also touches scheduler.py and belongs to live sgl-project#722.
* Cluster B, planner/seam: fix/602-fill-side, fix/701-ledger-wiring and
  feat/704-prefill-ladder each rewrote seam_slope.py, planner/pp_cut.py and
  test_pp_cut_prefill_speed_702.py. Three lanes editing one model of the same
  thing -- the conflict is SEMANTIC, and resolving it by taking hunks would
  produce a seam model nobody designed.
* The clean six-step train (621, 699, 673-lockstep, 706, 717, 677) merged in
  sequence with no conflicts at all and can run without either cluster.

TEST MATRIX, measured on the merged probe state: mem_cache 940 failed / 973
passed and distributed 21 failed / 2716 passed, both matching the standing
baselines. managers came out at 12 failed / 2274 passed against a standing
figure of 14 -- and the point is that this suite's count is
TRAIN-COMPOSITION-DEPENDENT: this lane's branch alone shows 4, the merged probe
12, with the extra 8 arriving from the sgl-project#677/sgl-project#713/sgl-project#631 lanes rather than from
the merge. The failing classes are listed so they can be attributed, and each
owner must record their own baseline before the train, or "the branch shipped
it" becomes "the merge broke it".

HELD OUT, with the separability question answered: 2ce1ed7 is NOT docs-only
-- it changes managers/phase_flip_runtime.py, which is exactly why it earns its
review boot. The two later sgl-project#441 commits touch no file it touches, so they are
cherry-pickable without it; the only entanglement on that branch is
be1fcec -> 2ce1ed7 (same NOTE). But 4512136 carries
sgl-kernel/csrc/kvcacheio/transfer.cu, so riding it means a kernel rebuild --
its own boot-gated risk, not something to smuggle in behind a docs-and-tests
framing.

Also in this push: the sgl-project#568 ledger commit (79216e6), which the audit found
was this lane's only unpushed work.
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 24, 2026
THE CLASS FIX, and the half sgl-project#822 named and did not build. `fe43b09e52` states
it as its own open item: `_retire_row_id_space` "does not yet REFUSE such an id
at the allocator -- that is enforcement". O-2 recorded audit-only as an owner
decision on hot-path blast-radius grounds; the reversal is on record in
WINDOW-QUEUE with the scope that answers that objection exactly -- enforcement
at THE TWO SEAM EVENTS ONLY, where the id space changes regime, never per
allocation. The hot allocation path is untouched.

WHY IT WAS NEEDED, from my own window: the authority observed
"exposed 470755 > committed 126976" and said so 48 times in ONE boot while the
instance livelocked on that exact gap, and the sgl-project#816 clamp fired twice. An
instrument that names the root once per arm and binds nobody is not a gate.

SEAM ONE -- THE CUTOVER (`_execute`, beside `retire(direction)`).
`retire()` is the audit half: it stamps a new epoch and reports. The
enforcement call sits deliberately OUTSIDE that try/except, because a swallowed
audit must not also swallow the gate -- enforcement would inherit the exact
silence it exists to end.

SEAM TWO -- THE SHRINK RESTATEMENT (`_shrink_to`, success path). The FAILED
shrink path already clamped ("undoing the cap must not hand out ids the failed
shrink never backed"); the SUCCESSFUL path did not. So a working shrink was the
one way to widen the exposed-vs-committed gap with nothing saying so -- which is
W22's state exactly: withheld=343779 constant while free and cached swung
126845/131 -> 3729/106449, exposed 470755 against committed 126976, and every
id-space-derived quantity downstream still pricing unbacked ids. The accounting
was self-consistent; the law was broken. Both branches now call the same
actuator, so they cannot drift.

NO NEW ACTUATOR. Both seams call `clamp_exposure_to_backing` (sgl-project#816), whose own
contract is why it is safe here: it "only ever LOWERS exposure toward
`_current_rows()` -- a MEASURED committed count, never a remembered one -- and
it never lowers the BACKING". So it cannot cap below a live set. The direction
guard therefore holds BY CONSTRUCTION rather than by care, and an under-backed
pool is REPORTED by that actuator rather than papered over. This is the sgl-project#722
direction the retracted floor-clamp remedy would have broken;
TheLevellingMustNotCapBelowTheLiveSet and test_floor_local_cap_812 were run
explicitly and are green (20 passed).

`_enforce_exposure_at_seam` returns rows withdrawn so a caller or test asserts
on the ACTION, not on the absence of a symptom, and never raises: a seam is
mid-flight, and enforcement that kills a cutover is worse than the exposure it
corrects. It refuses; it does not explode.

WHAT THIS DOES NOT CLOSE -- recorded in docs/dev/NOTE_851_build_caveats.md so
it cannot be miscited. `floor > cap` SURVIVES this fix: with
exposed == committed == 126976, max_live can still sit at the cap and the floor
is max_live + 1 + margin + reserve = 131073 BY DESIGN, since the admission
reserve is deliberately above the high-water mark. F1 converts a permanent
SILENT veto into an explicit grow requirement at the seam; F2 is what makes that
grow fundable or refuses it at boot. The exposure/veto falsifier therefore stays
xfail until F1+F2 are BOTH in -- it is the composite's acceptance, not F1's, and
it must not be "flipped" by teaching the reduction to drop an under-backed
rank's floor (that takes the rank below its own live set =
cudaErrorIllegalAddress; the reasoning is in the note).

Also recorded there: F4 is ATTRIBUTION, not payout, and must never be cited as
closing sgl-project#813 on its own.

Tests: 5 new (W22's numbers corrected at the seam; a sound id space untouched;
backing never lowered and exposure never RAISED; a missing rung survivable; a
raising rung cannot kill a cutover). 1057 passed / 1 xfailed / 0 failures
across the funding, relief, corridor, floor, backing, ownership, arming, spill,
exposure and levelling suites. ruff clean. Hermetic, CVD="", no boots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants