Repository navigation
fix(engine): start a single rank without a rendezvous port - #615
Draft
YevheniiKotyrlo wants to merge 1 commit into
Draft
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
KarrAcaRn
pushed a commit
to KarrAcaRn/FreeToken-ByAI
that referenced
this pull request
Oct 6, 2026
FlashML-org#604 rejected (accepts JSON response formats without enforcing them); FlashML-org#605 deferred (pre-sm70 only); drafts FlashML-org#614, FlashML-org#615, FlashML-org#616 deferred with what next already covers. Assisted-by: Claude Opus 5.5
YevheniiKotyrlo
force-pushed
the
fix-single-rank-rendezvous
branch
from
October 13, 2026 14:06
df2550a to
d2a55ed
Compare
This branch has not been deployed
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.
Part of #301
Problem
With the default
--tensor-parallel-size 1, the engine still forms its one-rank gloo group through a TCP rendezvous: on--port+ 1 for a server (ServerArgs.distributed_addr), and on the fixed127.0.0.1:2333for an offline engine (EngineConfig.distributed_addr). Anything listening there fails the load withDistNetworkError: ... EADDRINUSE, as #301 reports. As benwilson found there, that store also listens on every interface, and on Windows every start logs[c10d] The client socket has failed to connect to ...:<port + 1>. A single rank meets no other process, so it needs none of this.Solution
_init_communicationtakes where the ranks meet from_rendezvous. A single rank forms its group over aFileStoreat a freshtempfile.mkstemppath, which it deletes as soon asinit_process_groupreturns. A one-rank gloo group does not read its store again: collectives anddestroy_process_grouprun with the file gone, and nothing recreates it. So no port is bound, and a run killed after that point leaves no file.More than one rank keeps
init_method=config.distributed_addras before, and the--tensor-parallel-sizehelp now says those ranks meet on--port+ 1.I used a
FileStorebecause it is the one store that needs no socket on both platforms. torch builds noHashStoreon Windows (torch/distributed/__init__.pyimports it only offwin32). ATCPStoreon an OS-chosen port would still listen, and on Windows it needsuse_libuv=False.The two
init_process_groupcalls differed only in the backend, so they become one.Tests
tests/engine/test_communication.py:--port+ 1 is held, and an offline engine starts while2333is held. Onmainboth fail withDistNetworkError(EADDRINUSEon Linux, system error 10048 on Windows).all_reducewith no store file left. The test fails when the file is kept.Verification
RTX 3090 Ti (driver 617.14), Ryzen 9 9950X3D,
Qwen/Qwen3-0.6B. The command waspython -m freetoken --model-path Qwen3-0.6B --host 127.0.0.1 --port 21000 --num-pages 4000, with127.0.0.1:21001held by another socket.mainat555efd8). Onmainthe load fails withEADDRINUSEon 21001. With this change the server is ready in 19.5 s, answers a chat completion and exits cleanly on SIGTERM, and/tmpholds nofreetoken_store_*file. Overmainat9c635a1(WSL2 Ubuntu 24.04, Python 3.12, torch 2.14.0),pytest tests/engine tests/scheduler tests/servergives 828 passed and 3 skipped;maingives 825 and 3. Both fail the same twofifixtures, which need flashinfer.mainat555efd8). A Windows serve needs fix(windows): build the extensions and JIT kernels with MSVC #575, fix(windows): serve over loopback ZMQ and a selector event loop #580 and fix(windows): read checkpoints without O_DIRECT, posix_fadvise or PROT_READ #581, so both runs had them. Without this change the load fails withDistNetworkError ... (system error: 10048). With it the server is ready in 29.9 s and answers a chat completion. Its log has no[c10d]line, and Ctrl+C stops it with every worker gone and no store file in%TEMP%.I could not run more than one rank, since this machine has one GPU. That path keeps the rendezvous it had on
main.Related
#461 also touches
_init_communication: it makes the port configurable (default--port+ 1) and binds the store to loopback for every TP size. This change removes the rendezvous for a single rank instead and leaves more than one rank as it is, so #461's approach still applies there. On Windows, its explicitTCPStore(...)needsuse_libuv=False, since torch has no libuv there:DistStoreError: use_libuv was requested but PyTorch was built without libuv support.