Skip to content

Conversation

@ChieloNewctle
Copy link
Contributor

Based on #1150.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ChieloNewctle, 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 updates the project's HTTP server infrastructure by replacing Gunicorn with Hypercorn. This change is crucial for enabling HTTP/2 (h2c) support, which can lead to improved performance and efficiency in handling web requests. Additionally, the update includes a refinement in process management to accurately identify and exclude internal system processes, ensuring more robust and reliable application behavior.

Highlights

  • HTTP Server Migration: The project has migrated from using Gunicorn to Hypercorn as its HTTP server, primarily to introduce HTTP/2 (h2c) support.
  • Process Discovery Improvement: The logic for identifying sibling processes has been enhanced to filter out internal multiprocessing.resource_tracker processes, preventing their incorrect identification as application-related processes.
  • Dependency Update: The requirements.txt file has been updated to reflect the change in the HTTP server dependency, replacing Gunicorn with Hypercorn.

🧠 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
  • lightllm/server/api_start.py
    • Removed the import for get_lightllm_gunicorn_time_out_seconds as it's no longer relevant.
    • Replaced gunicorn with hypercorn in the command execution for normal_or_p_d_start, pd_master_start, and config_server_start functions.
    • Removed the --worker-class uvicorn.workers.UvicornWorker argument, which is specific to Gunicorn.
    • Updated the timeout parameter from --timeout to --read-timeout for Hypercorn in normal_or_p_d_start and config_server_start.
    • Removed the --timeout parameter entirely from pd_master_start.
  • lightllm/server/req_id_generator.py
    • Modified the _find_sibling_processes function to include cmdline when iterating through processes.
    • Added a filter to exclude multiprocessing.resource_tracker processes from the list of sibling processes.
  • lightllm/utils/envs_utils.py
    • Removed the get_lightllm_gunicorn_time_out_seconds function, aligning with the removal of Gunicorn.
  • requirements.txt
    • Replaced gunicorn==23.0.0 with hypercorn==0.18.0.
Activity
  • No specific activity (comments, reviews, etc.) 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 replaces gunicorn with hypercorn to add support for HTTP/2. The changes primarily involve updating server startup commands in lightllm/server/api_start.py and modifying dependencies in requirements.txt. While the core change is sound, I've identified a critical issue where a deleted utility function for timeout configuration is still being called in two places. This would cause the server to fail at startup. I've provided suggestions to remove these calls, which aligns with how the timeout was handled in other parts of the same file. Other changes, such as filtering out a new process type spawned by hypercorn, appear correct and necessary.

Comment on lines 354 to 355
"--read-timeout",
f"{get_lightllm_gunicorn_time_out_seconds()}",
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The function get_lightllm_gunicorn_time_out_seconds called on line 355 has been removed in lightllm/utils/envs_utils.py, but it's still being called here. This will cause a NameError at runtime. The timeout configuration was removed for pd_master_start, so it should probably be removed here as well for consistency.

Comment on lines 459 to 460
"--read-timeout",
f"{get_lightllm_gunicorn_time_out_seconds()}",
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The function get_lightllm_gunicorn_time_out_seconds called on line 460 has been removed in lightllm/utils/envs_utils.py, but it's still being called here. This will cause a NameError at runtime. The timeout configuration was removed for pd_master_start, so it should probably be removed here as well for consistency.

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 replaces Gunicorn with Hypercorn to enable HTTP/2 support, which is a great enhancement. The changes correctly update the server startup commands and dependencies. My main feedback revolves around the worker timeout configuration. The previous explicit timeout setting was removed, which causes the server to fall back to Hypercorn's much shorter default timeout. This could potentially lead to issues with long-running requests. I've provided suggestions to reintroduce a configurable worker timeout to ensure consistent behavior.

@@ -353,8 +351,6 @@ def normal_or_p_d_start(args):
"--error-logfile",
"-",
"lightllm.server.api_http:app",
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Hypercorn's default worker timeout is 30 seconds, which is significantly lower than the previous Gunicorn timeout of 180 seconds. This could cause issues with long-running requests. It's advisable to explicitly set the worker timeout to maintain similar behavior. I'd recommend making this value configurable, for example by re-introducing a function like the removed get_lightllm_gunicorn_time_out_seconds but for hypercorn.

Suggested change
"lightllm.server.api_http:app",
"lightllm.server.api_http:app",
"--worker-timeout",
"180",

@@ -422,8 +416,6 @@ def pd_master_start(args):
"-",
"--preload",
"lightllm.server.api_http:app",
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Hypercorn's default worker timeout is 30 seconds, which is significantly lower than the previous Gunicorn timeout of 180 seconds. This could cause issues with long-running requests. It's advisable to explicitly set the worker timeout to maintain similar behavior. I'd recommend making this value configurable, for example by re-introducing a function like the removed get_lightllm_gunicorn_time_out_seconds but for hypercorn.

Suggested change
"lightllm.server.api_http:app",
"lightllm.server.api_http:app",
"--worker-timeout",
"180",

@@ -464,8 +454,6 @@ def config_server_start(args):
"-",
"--preload",
"lightllm.server.config_server.api_http:app",
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Hypercorn's default worker timeout is 30 seconds, which is significantly lower than the previous Gunicorn timeout of 180 seconds. This could cause issues with long-running requests. It's advisable to explicitly set the worker timeout to maintain similar behavior. I'd recommend making this value configurable, for example by re-introducing a function like the removed get_lightllm_gunicorn_time_out_seconds but for hypercorn.

Suggested change
"lightllm.server.config_server.api_http:app",
"lightllm.server.config_server.api_http:app",
"--worker-timeout",
"180",

@shihaobai shihaobai merged commit a27dfc8 into main Feb 9, 2026
1 check passed
@shihaobai shihaobai deleted the feat-hypercorn branch February 9, 2026 10:36
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.

3 participants