Skip to content

Diffusion DDP tests: destroy the gloo group in each rank and dump a stuck rank stack (all-reduce timeout) - #18908

Merged
danielhanchen merged 1 commit into
mainfrom
fix/diffusion-ddp-test-child-teardown
Nov 22, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/diffusion-ddp-test-child-teardown

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

studio/backend/tests/test_diffusion_ddp.py::test_all_reduce_averages_grads_and_loss_and_flags still times out now and then after #18885. It failed again on the Imagineer99 staging run for #18900, on base da4430f, which includes #18885. That run settles what #18885 got wrong: both ranks print [Gloo] Rank N is connected to 1 peer ranks before the hang, so the rendezvous works and a port race was not the cause. (The FileStore rendezvous from #18885 is still fine to keep.) The ranks stall after connecting, and pytest-timeout then kills the test with only the parent's p.wait() stack in the log, so nothing says where.

I could not reproduce it here: 24 runs, 12 at a time, all passed in about 10 s each.

Changes (test harness only)

  • Each spawned rank calls dist.destroy_process_group() on the way out, as the real workers do in DistContext.close(). The children used to exit with a live gloo group, and that teardown at interpreter exit is the most likely place for an intermittent stall.
  • Each rank arms faulthandler.dump_traceback_later(240, exit = True), below the 330 s pytest-timeout. If a rank is still running at 240 s it prints every thread's stack and exits non-zero, _spawn's exit-code assert fails, and the log says exactly where it was stuck. If this does not remove the flake, the next failure is self-diagnosing.

Testing

  • studio/backend/tests/test_diffusion_ddp.py: 22 passed.
  • Sabotage: with rank 1 made to sleep and the dump window shortened to 8 s, the test fails in 19 s with assert [1, 1] == [0, 0] and both ranks' stacks, pointing at the line in _child_grads where each was waiting.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 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-22T15:31:25.514949Z 58d0205 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.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 58d020509b

ℹ️ 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 6d06ef7 into main Nov 22, 2026
@danielhanchen
danielhanchen deleted the fix/diffusion-ddp-test-child-teardown branch November 22, 2026 15:32
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