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

[Bugfix] use AF_INET6 instead of AF_INET for OpenAI Compatible Server #9583

Merged
merged 10 commits into from
Nov 15, 2024

Conversation

jxpxxzj
Copy link
Contributor

@jxpxxzj jxpxxzj commented Oct 22, 2024

Currently the OpenAI Compatible Server creates a socket outside of vllm.entrypoints.launcher.serve_http, and this socket uses the socket.AF_INET address family. On machines with only IPv6 addresses, this limitation prevents the socket from being accessed externally.
I made a small modification, changing it to socket.AF_INET6, so that it supports both IPv4 and IPv6 addresses.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

Signed-off-by: xiaozijin <[email protected]>

use AF_INET6 instead of AF_INET

fallback to AF_INET if IPv6 is not available

refactory create socket

refactory create socket

style and logging fix

style and logging fix

style fix

style fix
@piamo
Copy link

piamo commented Oct 28, 2024

there's a simple implemention

addr = ("", args.port)
if socket.has_dualstack_ipv6():
    sock = socket.create_server(addr, family=socket.AF_INET6, dualstack_ipv6=True)
else:
    sock = socket.create_server(addr)

Signed-off-by: xiaozijin <[email protected]>
Signed-off-by: xiaozijin <[email protected]>
Signed-off-by: xiaozijin <[email protected]>
vllm/entrypoints/openai/api_server.py Outdated Show resolved Hide resolved
vllm/entrypoints/openai/api_server.py Show resolved Hide resolved
Copy link

mergify bot commented Nov 7, 2024

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @jxpxxzj.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the frontend label Nov 7, 2024
@mergify mergify bot removed the needs-rebase label Nov 11, 2024
Copy link
Collaborator

@russellb russellb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great now. Thanks for the IPv6 fix!

@shcheglovnd
Copy link
Contributor

I made a small modification, changing it to socket.AF_INET6, so that it supports both IPv4 and IPv6 addresses.

AF_INET6 does not support both ipv4 and ipv6 by default. It can be ipv6 only, so we should not use it here by default.

@jxpxxzj
Copy link
Contributor Author

jxpxxzj commented Nov 13, 2024

hi @njhill please review this pr at your convenience and share more suggesstions :)

@russellb
Copy link
Collaborator

hi @njhill please review this pr at your convenience and share more suggesstions :)

It looks like the suggested change from previous review still needs to be completed.

@jxpxxzj
Copy link
Contributor Author

jxpxxzj commented Nov 14, 2024

hi @njhill please review this pr at your convenience and share more suggesstions :)

It looks like the suggested change from previous review still needs to be completed.

should all fixed and ci passed, please check again :)

Copy link
Collaborator

@russellb russellb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

It's ready for another look from you, @youkaichao

Copy link
Member

@youkaichao youkaichao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix!

@youkaichao youkaichao merged commit 554af92 into vllm-project:main Nov 15, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants