Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Minor fix] The domain dns.google may cause a socket.gaierror exception #3176

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

ttbachyinsda
Copy link
Contributor

May Fix #3170

In specific network environments, the following code may throw a socket.gaierror exception because the domain dns.google cannot be resolved correctly to an IP address. The issue can be solved by directly using 8.8.8.8, even if 8.8.8.8:80 is not accessible.

def get_ip() -> str:
    # try ipv4
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    try:
        s.connect(("dns.google", 80))  # Doesn't need to be reachable
        return s.getsockname()[0]
    except OSError:
        # try ipv6
        s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
        s.connect(("dns.google", 80))
        return s.getsockname()[0]

File "/usr/local/lib/python3.10/dist-packages/vllm/entrypoints/llm.py", line 109, in init
self.llm_engine = LLMEngine.from_engine_args(engine_args)
File "/usr/local/lib/python3.10/dist-packages/vllm/engine/llm_engine.py", line 391, in from_engine_args
engine = cls(*engine_configs,
File "/usr/local/lib/python3.10/dist-packages/vllm/engine/llm_engine.py", line 128, in init
self._init_workers()
File "/usr/local/lib/python3.10/dist-packages/vllm/engine/llm_engine.py", line 167, in _init_workers
get_ip(), get_open_port())
File "/usr/local/lib/python3.10/dist-packages/vllm/utils.py", line 181, in get_ip
s.connect(("dns.google", 80))
socket.gaierror: [Errno -2] Name or service not known

@payoto
Copy link
Contributor

payoto commented Mar 4, 2024

Similar to #2961 either of these can be merged

@simon-mo simon-mo enabled auto-merge (squash) March 4, 2024 18:38
@simon-mo simon-mo merged commit 76e8a70 into vllm-project:main Mar 4, 2024
22 checks passed
@ttbachyinsda ttbachyinsda deleted the dns_google_fix branch March 5, 2024 02:21
AdrianAbeyta pushed a commit to AdrianAbeyta/vllm that referenced this pull request Mar 8, 2024
…on (vllm-project#3176)

Co-authored-by: guofangze <guofangze@kuaishou.com>
dtransposed pushed a commit to afeldman-nm/vllm that referenced this pull request Mar 26, 2024
…on (vllm-project#3176)

Co-authored-by: guofangze <guofangze@kuaishou.com>
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.

why vllm==0.3.3 need to access google
3 participants