Skip to content

Conversation

@JunyiXu-nv
Copy link
Collaborator

@JunyiXu-nv JunyiXu-nv commented Dec 10, 2025

Summary by CodeRabbit

  • Improvements
    • Enhanced server reliability with improved initialization error handling.
    • Added configuration options for request timeouts and metrics collection intervals.
    • Added garbage collection configuration option via environment variable for resource optimization.

✏️ Tip: You can customize this high-level summary in your review settings.

Description

Do like what we did for agg serve: #9646.

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@JunyiXu-nv JunyiXu-nv requested a review from a team as a code owner December 10, 2025 02:40
@JunyiXu-nv JunyiXu-nv requested a review from chuangz0 December 10, 2025 02:40
@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 10, 2025

📝 Walkthrough

Walkthrough

The changes enhance socket handling in the disaggregated server initialization. A bound listening socket is created within a context manager before server instantiation. New timeout and metrics parameters are added to OpenAIDisaggServer. GC disable behavior is now conditional. The bound socket is passed to asyncio.run for server startup.

Changes

Cohort / File(s) Summary
Disaggregated server socket binding
tensorrt_llm/commands/serve.py
Creates and binds a socket within a context manager before server instantiation. Moves metadata server config parsing into the socket context. Adds conditional GC disable logic based on environment variable.
Server invocation signature
tensorrt_llm/serve/openai_disagg_server.py
Updates __call__ method to accept optional sockets parameter. Imports socket module for type annotation. Passes sockets to uvicorn.Server.serve().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Socket binding context manager: Verify proper resource cleanup and error handling in the with block
  • Parameter threading: Ensure new timeout and metrics parameters are correctly propagated through the server initialization chain
  • GC conditional logic: Confirm environment variable parsing and the intended GC behavior in both enabled and disabled states
  • Socket passing to asyncio: Verify uvicorn.Server correctly handles the passed socket parameter

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains a reference to a similar PR without explaining what the actual issue is, why it needs to be fixed, or how this PR addresses it. Expand the description to explain the problem being solved, the solution approach, and relevant test coverage instead of just referencing another PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: preserving IP and port for disaggregated server, which aligns with the code modifications to bind listening sockets and pass them to asyncio.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tensorrt_llm/commands/serve.py (1)

638-669: Socket binding & GC behavior are sound; refine exception chaining per Ruff hints

The new pattern of binding a TCP socket in a with block and passing sockets=[s] into asyncio.run(server(...)) is a solid match for the updated OpenAIDisaggServer.__call__ and ensures early, explicit bind failures while preserving the configured ip:port. The conditional GC disabling controlled by TRTLLM_DISAGG_SERVER_DISABLE_GC (defaulting to disabled) is also consistent with the accompanying comment and gives an escape hatch if needed.

You can tighten the error handling in the bind path and satisfy the Ruff B904/TRY003 hints by chaining the original OSError and shortening the custom message, e.g.:

-    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
-        try:
-            s.bind((disagg_cfg.hostname, disagg_cfg.port))
-        except OSError as e:
-            raise RuntimeError(
-                f"Failed to bind socket to {disagg_cfg.hostname}:{disagg_cfg.port}: {e}"
-            )
+    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
+        try:
+            s.bind((disagg_cfg.hostname, disagg_cfg.port))
+        except OSError as e:
+            raise RuntimeError(
+                f"Failed to bind socket to {disagg_cfg.hostname}:{disagg_cfg.port}"
+            ) from e

This preserves the original traceback context while keeping the custom message focused.

Please re-run Ruff (or your usual lint pipeline) on this file after applying the change to confirm B904/TRY003 are resolved. As per static analysis hints.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36c9e7c and 8c58b81.

📒 Files selected for processing (2)
  • tensorrt_llm/commands/serve.py (1 hunks)
  • tensorrt_llm/serve/openai_disagg_server.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: The code developed for TensorRT-LLM should conform to Python 3.8+
Indent Python code with 4 spaces; do not use tabs
Always maintain the namespace when importing in Python, even if only one class or function from a module is used (e.g., use from package.subpackage import foo and then foo.SomeClass() instead of from package.subpackage.foo import SomeClass)
Python filenames should use snake_case (e.g., some_file.py)
Python class names should use PascalCase (e.g., class SomeClass)
Python function and method names should use snake_case (e.g., def my_awesome_function():)
Python local variable names should use snake_case, with prefix k for variable names that start with a number (e.g., k_99th_percentile = ...)
Python global variables should use upper snake_case with prefix G (e.g., G_MY_GLOBAL = ...)
Python constants should use upper snake_case (e.g., MY_CONSTANT = ...)
Avoid shadowing variables declared in an outer scope in Python
Initialize all externally visible members of a Python class in the constructor
For Python interfaces that may be used outside a file, prefer docstrings over comments
Python comments should be reserved for code within a function, or interfaces that are local to a file
Use Google style docstrings for Python classes and functions, which can be parsed by Sphinx
Python attributes and variables can be documented inline with type and description (e.g., self.x = 5 followed by """<type>: Description of 'x'""" )
Avoid using reflection in Python when functionality can be easily achieved without reflection
When using try-except blocks in Python, limit the except clause to the smallest set of specific errors possible instead of catching all exceptions
When using try-except blocks in Python to handle multiple possible variable types (duck-typing), keep the body of the try as small as possible and use the else block to implement the logic

Files:

  • tensorrt_llm/commands/serve.py
  • tensorrt_llm/serve/openai_disagg_server.py
**/*.{cpp,h,cu,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

All TensorRT-LLM Open Source Software code files should contain an NVIDIA copyright header that includes the current year at the top

Files:

  • tensorrt_llm/commands/serve.py
  • tensorrt_llm/serve/openai_disagg_server.py
🧬 Code graph analysis (1)
tensorrt_llm/commands/serve.py (3)
tensorrt_llm/executor/rpc/rpc_server.py (1)
  • bind (91-115)
tensorrt_llm/llmapi/disagg_utils.py (1)
  • parse_metadata_server_config_file (325-333)
tensorrt_llm/serve/openai_disagg_server.py (1)
  • OpenAIDisaggServer (81-242)
🪛 Ruff (0.14.8)
tensorrt_llm/commands/serve.py

642-644: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


642-644: Avoid specifying long messages outside the exception class

(TRY003)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Pre-commit Check
🔇 Additional comments (1)
tensorrt_llm/serve/openai_disagg_server.py (1)

19-20: Socket-aware __call__ looks consistent with disagg startup flow

Adding the socket import and threading sockets: list[socket.socket] | None = None through to uvicorn.Server(config).serve(sockets=sockets) cleanly supports the pre-bound socket path while remaining backward compatible with existing 2-arg call sites. This aligns with the updated disaggregated command wiring and preserves the existing host/port behavior when sockets is left as None.

Please confirm your deployed uvicorn version supports the sockets keyword on Server.serve and that the disaggregated path has been exercised end‑to‑end in your CI or local tests.

Also applies to: 194-200

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27607 [ run ] triggered by Bot. Commit: 8c58b81

@JunyiXu-nv
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27796 [ run ] triggered by Bot. Commit: 8c58b81

@tensorrt-cicd
Copy link
Collaborator

PR_Github #27796 [ run ] completed with state SUCCESS. Commit: 8c58b81
/LLM/main/L0_MergeRequest_PR pipeline #21214 completed with status: 'SUCCESS'

@JunyiXu-nv JunyiXu-nv merged commit 710c592 into NVIDIA:main Dec 12, 2025
8 of 9 checks passed
sherry-1001 pushed a commit to sherry-1001/TensorRT-LLM that referenced this pull request Dec 16, 2025
codego7250 pushed a commit to codego7250/TensorRT-LLM that referenced this pull request Dec 19, 2025
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.

4 participants