Repository navigation
fix(utils): make find_node_ip return a usable address on loopback-only hosts - #301
Merged
tastelikefeet merged 1 commit intoOct 11, 2026
Merged
Conversation
…y hosts find_node_ip() returned None when no interface other than the loopback one exposes an IPv4 address (for example a container started with `docker run --network none`). RayHelper assigns the result to MASTER_ADDR, and a None there is not a valid env var value, so the failure surfaced deep inside Ray rather than pointing at the address lookup. Return 127.0.0.1 in that case, matching the intent of falling back to a virtual interface, and keep the previous preference order otherwise. Signed-off-by: li-lizhe <147392333@qq.com>
tastelikefeet
approved these changes
Oct 11, 2026
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
find_node_ip()returnsmain_ip or virtual_ip, which isNoneon a host where no interface other than the loopback one exposes an IPv4 address — for example a process started withdocker run --network none.RayHelperassigns that value toMASTER_ADDR:Noneis not a valid value there, so the failure surfaces inside Ray'senv_varsvalidation with an error that does not point back to the address lookup.This PR makes the final fallback
127.0.0.1, which matches the existing intent of falling back to a virtual interface, and leaves the preference order (non-virtual interface → virtual interface) unchanged.Verification
Pure-Python behaviour, reproduced before/after by loading
src/twinkle/utils/network.pyfrom a file path (with a fakepsutil) and calling the realfind_node_ip():The first two cases are unchanged; only the loopback-only case changes. A regression test covering all four cases is added in
tests/utils/test_network.py.Not tested
Nonevalue handed toMASTER_ADDRis demonstrated.Fixes #302