Skip to content

fix: abort process groups on rank-local training failure - #781

Merged
jiapingW merged 5 commits into
mainfrom
maocheng/colocate-2-teardown-abort
Sep 2, 2026
Merged

fix: abort process groups on rank-local training failure#781
jiapingW merged 5 commits into
mainfrom
maocheng/colocate-2-teardown-abort

Conversation

@maocheng23

@maocheng23 maocheng23 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Stack 1/5 replacing draft #766 (moved to the front of the stack: it is independent of colocated training and useful on its own). When one rank dies inside a run (a data or capture error) while its peers are blocked in a CUDA/FSDP collective, the collective destroy_process_group in the CLI's finally hangs in NCCL communicator destruction: the originating traceback never surfaces and torchrun cannot reap the job. Colocated online training makes rank-local capture failures a realistic event, but this fix applies to every distributed topology.

Modifications

  • destroy_distributed(abort=False): on the exceptional path, call the non-collective ProcessGroup.abort() on every distinct cached group, including the default group. Aborting does not unblock the peers by itself; torchrun/elastic terminates them once this rank exits non-zero with its real traceback (the docstring now says so). The success path keeps the existing collective destroy; torch builds without ProcessGroup.abort fall back to destroy.
  • The CLI _train marks the exceptional path with a failed flag and passes abort=failed to teardown.

Related Issues

Splits #766. Stack: #1 (this, on main)#782 rank0-tracker ← #780 capture-rows ← #783 colocated-core ← #784 hybrid-shard.

Accuracy Test

  • New test_failure_teardown_aborts_each_distinct_process_group verifies abort is called once per distinct group and collective destroy is not used on the failure path. The existing teardown test keeps covering the success path.
  • Rebased onto main 2fc99307 (sglang 0.5.18). CPU suite: failure set identical to main.

Checklist

  • Format your code according to the Code Formatting with Pre-Commit (black --check and isort --check-only).
  • Add unit tests.
  • Update documentation as needed (none needed).

maocheng23 and others added 3 commits September 1, 2026 17:23
destroy_process_group is collective; when one rank dies inside the run
while its peers are blocked in a CUDA/FSDP collective, teardown hangs in
NCCL communicator destruction, the originating traceback never surfaces,
and torchrun cannot reap the job. On the exceptional path the CLI now
calls destroy_distributed(abort=True), which uses the non-collective
ProcessGroup.abort() on every distinct cached group (including the
default group) so elastic sees the real exception. The success path
keeps the existing collective destroy.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Expose capture_rows(input_ids) on OfflineSGLangCaptureBackend and
OfflineSGLangCapture so callers can capture variable-length rows in one
packed prefill without building padded tensors. capture_eagle3 delegates
to it and keeps its exact request construction and outputs.

DSpark capture-layer setup now falls back from the native
set_dspark_layers_to_capture hook to the dense DFlash hook (with a log
line naming the resolved hook) so dense targets such as Qwen3 can serve
DSpark capture on stock SGLang 0.5.14 models.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every trainer rank constructed its own tracker, so W&B/MLflow runs were
duplicated world-size times and TensorBoard ranks wrote the same directory.
An external tracker is now created on global rank zero only; every rank keeps
the console logger, so console output is unchanged.
@maocheng23
maocheng23 force-pushed the maocheng/colocate-2-teardown-abort branch from 6a5cccd to bb22955 Compare September 2, 2026 00:24
@maocheng23
maocheng23 marked this pull request as ready for review September 2, 2026 00:25
…rows

refactor: extract packed capture_rows from the offline SGLang backend
…acker

fix: create the external metrics tracker only on trainer rank zero
@jiapingW
jiapingW merged commit bc5d845 into main Sep 2, 2026
6 checks passed
@jiapingW
jiapingW deleted the maocheng/colocate-2-teardown-abort branch September 2, 2026 04:55
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