Skip to content

[Bugfix][18201]: use loopback for url when --host='' to allow warmup with dual stack#18202

Open
GuyStone wants to merge 1 commit intosgl-project:mainfrom
GuyStone:dualstack-warmup
Open

[Bugfix][18201]: use loopback for url when --host='' to allow warmup with dual stack#18202
GuyStone wants to merge 1 commit intosgl-project:mainfrom
GuyStone:dualstack-warmup

Conversation

@GuyStone
Copy link
Contributor

@GuyStone GuyStone commented Feb 3, 2026

Motivation

Modifications

  • use loopback for url when --host='' to allow warmup with dual stack

Tests

$ python -m sglang.launch_server --model-path Qwen/Qwen3-0.6B --host ''
..
[2026-02-03 23:06:57] INFO:     Started server process [1706512]
[2026-02-03 23:06:57] INFO:     Waiting for application startup.
[2026-02-03 23:06:57] Using default chat sampling params from model generation config: {'repetition_penalty': 1.0, 'temperature': 0.6, 'top_k': 20, 'top_p': 0.95}
[2026-02-03 23:06:57] Using default chat sampling params from model generation config: {'repetition_penalty': 1.0, 'temperature': 0.6, 'top_k': 20, 'top_p': 0.95}
[2026-02-03 23:06:57] INFO:     Application startup complete.
[2026-02-03 23:06:57] INFO:     Uvicorn running on http://:30000 (Press CTRL+C to quit)
[2026-02-03 23:06:58] INFO:     127.0.0.1:58678 - "GET /model_info HTTP/1.1" 200 OK
[2026-02-03 23:06:59] Prefill batch, #new-seq: 1, #new-token: 6, #cached-token: 0, token usage: 0.00, #running-req: 0, #queue-req: 0, input throughput (token/s): 0.00, cuda graph: False
[2026-02-03 23:06:59] INFO:     127.0.0.1:58694 - "POST /generate HTTP/1.1" 200 OK
[2026-02-03 23:06:59] The server is fired up and ready to roll!

Benchmarking and Profiling

Checklist

Review Process

  1. Ping Merge Oncalls to start the PR flow. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • /tag-run-ci-label, /rerun-failed-ci, /tag-and-rerun-ci
  4. After green CI and required approvals, ask Merge Oncalls to merge.

@github-actions github-actions bot added the diffusion SGLang Diffusion label Feb 3, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @GuyStone, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug where the server failed to construct a valid URL when the --host argument was set to an empty string, which is typically used for dual-stack network configurations. By explicitly mapping an empty host to the loopback address, the change ensures that the server can successfully start and perform warmup procedures in such environments, improving compatibility and robustness.

Highlights

  • Dual-Stack Binding Support: The server's URL construction logic has been updated to correctly handle cases where the --host argument is provided as an empty string. This configuration, intended for dual-stack binding, now defaults the URL to the IPv4 loopback address (127.0.0.1) to ensure proper server initialization and warmup.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • python/sglang/multimodal_gen/runtime/server_args.py
    • Modified the url method within the ServerArgs class to check if self.host is empty. If it is, the method now returns a URL using http://127.0.0.1:{self.port}.
    • Added a comment explaining that an empty --host enables dual-stack binding and defaults to loopback for URL construction.
  • python/sglang/srt/server_args.py
    • Modified the url method within the ServerArgs class to check if self.host is empty. If it is, the method now returns a URL using http://127.0.0.1:{self.port}.
    • Added a comment explaining that an empty --host enables dual-stack binding and defaults to loopback for URL construction.
Activity
  • No human activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly fixes a bug where an empty host string for dual-stack binding resulted in an invalid URL for server warmup. The change to use the loopback address 127.0.0.1 is appropriate. However, the same fix has been applied in two different files, indicating code duplication. I've added a specific comment with a suggestion to refactor this to improve maintainability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant