Repository navigation
Distributed tests: take every MASTER_PORT from the shared rendezvous helper - #15679
Merged
Merged
Conversation
Member
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This was referenced Oct 28, 2026
danielhanchen
added a commit
that referenced
this pull request
Oct 28, 2026
#15745) ## Summary `Repo tests (CPU, rest)` fails on main with three guard failures. It shows on every staging CI run of recent PRs (#15613, #15615, #15673 and others), whatever the PR changes: ``` tests/test_rendezvous_port_everywhere.py::test_distributed_tests_take_their_port_from_the_shared_helper tests/test_gc_skip_auto_dist_cells.py: _free_port does not use tests._rendezvous_port tests/test_gc_skip_auto_dist_gloo.py: _free_port does not use tests._rendezvous_port tests/test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding[5] tests/test_mamba_fused_lora_adapters.py:464: read_text() tests/test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding[13] tests/test_refresh_moved_layer_devices.py:81: read_text() ``` These tests landed around the same time as the guards that now catch them: - 570b9b8 added the two `gc_skip_auto_dist` gloo tests with their own `bind(("127.0.0.1", 0))` port picker. That is the ephemeral-range race that #15679 moved every distributed test off, which produces `EADDRINUSE`. - 986558e and 7f3c5a1 read checked-in source with the platform default encoding, which breaks on Windows once the file gains a non-ASCII byte. The guards are right in all three cases, so the tests change, not the guards. ## Change - `tests/test_gc_skip_auto_dist_cells.py`, `tests/test_gc_skip_auto_dist_gloo.py`: `_free_port()` delegates to `tests._rendezvous_port.free_port()`, the same three lines every other distributed test uses. The now-unused `import socket` is dropped. - `tests/test_mamba_fused_lora_adapters.py:464`, `tests/test_refresh_moved_layer_devices.py:81`: `read_text(encoding = "utf-8")`. ## Testing - `tests/test_source_read_encoding.py` + `tests/test_rendezvous_port_everywhere.py`: 3 failed on main, 22 passed with this change. - The four touched test files under `-n 4`: 43 passed, 4 skipped.
danielhanchen
added a commit
to Etherll/unsloth
that referenced
this pull request
Oct 28, 2026
…d helper (unslothai#15729) `tests/test_rendezvous_port_everywhere.py::test_distributed_tests_take_their_port_from_the_shared_helper` fails on main: `test_gc_skip_auto_dist_cells.py` and `test_gc_skip_auto_dist_gloo.py` (added in unslothai#15545) still bind their own `127.0.0.1:0` socket for the rendezvous port. unslothai#15679 added the check right after them, so they were never moved to `tests._rendezvous_port.free_port()`. Both `_free_port()` helpers now call the shared helper, and the unused `import socket` goes. - `test_rendezvous_port_everywhere.py`: 1 failed / 5 passed on main, 6 passed here. - `test_gc_skip_auto_dist_gloo.py`: passes (CPU gloo). `test_gc_skip_auto_dist_cells.py` needs a CUDA device for its NCCL cases; on a CPU-only host the same 5 fail on main and here ("No CUDA GPUs are available"), 8 pass. Tests only; no library or Studio code changes.
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.
Summary
Repo tests (CPU, gloo)has failed twice with every rank dying before the test starts:tests/test_tp_native_gloo.py::test_sharded_loading_matches_full_load[phi3-2-None]test_tp_x_fsdp2_refuses_trainable_head_norms, port 42541, also intests/test_tp_native_gloo.py#14334 fixed this race by adding
tests/_rendezvous_port.free_port():That PR moved 21 tests onto the helper, but 15 distributed tests still pick their port with
bind(("127.0.0.1", 0)),tests/test_tp_native_gloo.pyamong them. Both failing ports above are inside the ephemeral range.Change
_free_port()now delegates totests._rendezvous_port.free_port(), the same three lines the other 21 files use, and their now-unusedsocketimports are dropped:test_tp_native_gloo.py,test_pp_native_gloo.py,test_pp_fsdp2_gloo.py,test_parallel_general_gloo.pytest_moe_dw_accumulate.py,test_ddp_find_unused_default.py,test_ddp_comm_defaults.pytest_fast_inference_torchrun_agreement.py,test_cudnn_sdpa_grad_layout_dtensor.pytests/python/: block compile DDP, GRPO DDP sync, plain trainer DDP, sentence transformer DDP and FSDP2 savetests/test_token_budget_batches.py: the inlinebind(0)beforeMASTER_PORTnow uses the helper.tests/test_rendezvous_port_everywhere.py(new): any test outsidetests/studiothat sets up a torch rendezvous (MASTER_PORT,master_port,init_process_grouporTCPStore) must either define_free_portthrough the helper or not bind port 0 at all.Testing
tests/test_rendezvous_port_everywhere.py: 6 passed.tests/test_tp_native_gloo.pyandtests/test_token_budget_batches.pyrestored from main, the guard fails and names both files.tests/test_token_budget_batches.pyand the new guard, under-n 4: 243 passed, 2 skipped. On main the same 14 files plustest_token_budget_batches.py(without the guard): 237 passed, 2 skipped.