Skip to content

gloo-tp tests: a rank that finished is not failed by an abort in interpreter teardown - #17244

Merged
danielhanchen merged 1 commit into
mainfrom
ci/gloo-tp-ranks-skip-teardown
Nov 9, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
ci/gloo-tp-ranks-skip-teardown

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

Repo tests (CPU, gloo-tp) keeps going red on tests/test_tp_native_gloo.py::test_trainer_length_samplers_resume_like_an_uninterrupted_run[2-group_by_length], always the same way:

E   AssertionError: rank exit codes [-6, 0, 0, 0]
terminate called without an active exception

It hit main itself (Nov 9 00:25 UTC), #17206 and a staging run of #17237 within about 15 hours, on PRs that do not touch tensor parallelism. In each run, one rank of four died with SIGABRT from std::terminate on a joinable C++ thread while the interpreter was tearing down, after the case had run and the process group had been destroyed. The other three ranks exited 0. It never reproduced locally, in 25 runs of that test.

_worker now records that the case finished and its result was saved, destroys the process group as before, then flushes stdio and calls os._exit(0). Interpreter teardown can no longer change the exit code of a rank whose work is done. A case that raises, a failed torch.save or a failing destroy_process_group still exits non-zero, so the parent still fails, and the results are still read back and checked exactly as before.

Changes

  • tests/test_tp_native_gloo.py:
    • _worker skips interpreter teardown once the case has finished and its result is on disk.
    • New teardown_abort case, which registers os.abort with atexit to stand in for an abort during teardown.
    • New test test_a_rank_that_finished_is_not_failed_by_an_abort_in_teardown, which runs that case on two ranks and expects both results back.

The other *_gloo.py suites only import helpers from this file and have their own workers, so they are unchanged.

Testing

  • The new test passes. With the os._exit path disabled it fails with rank exit codes on the atexit abort, so it guards the fix.
  • The full tests/test_tp_native_gloo.py passes locally (57 passed).
  • ruff and the scanner-shape and exec-literal lints are clean.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T15:27:27.832432Z 2582261 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 2582261587

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit c405205 into main Nov 9, 2026
@danielhanchen
danielhanchen deleted the ci/gloo-tp-ranks-skip-teardown branch November 9, 2026 17:14
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.

1 participant