Skip to content

Conversation

@Superjomn
Copy link
Collaborator

@Superjomn Superjomn commented Aug 19, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of non-blocking queue operations by adding configurable retry and wait-time behavior, reducing transient send failures and making shutdown/result delivery more stable under load.
  • Documentation

    • Added inline documentation describing non-blocking send behavior, retry semantics and parameters.
  • Tests

    • Reorganized several LLM API unit tests into the PyTorch test suite; no test logic changes.

Description

Fix the zmq send_nonblock issue with retry.
Move llmapi-related unittests to pre-merge to avoid being broken frequently in post-merge.

Test Coverage

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.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

Warning

Rate limit exceeded

@Superjomn has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 23 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d7cafad and 6c4b800.

📒 Files selected for processing (4)
  • tensorrt_llm/executor/ipc.py (1 hunks)
  • tensorrt_llm/executor/proxy.py (1 hunks)
  • tensorrt_llm/llmapi/mpi_session.py (1 hunks)
  • tests/integration/test_lists/test-db/l0_a10.yml (1 hunks)
📝 Walkthrough

Walkthrough

Adds retryable non-blocking send to ZeroMqQueue.put_noblock (new keyword-only params retry, wait_time) with input validation and logging on exhaustion; updates two callers to pass retry values; and moves six llmapi unit tests from the CPP block to the PyTorch block in the integration test list.

Changes

Cohort / File(s) Summary
IPC queue retry logic
tensorrt_llm/executor/ipc.py
Added retryable non-blocking send in ZeroMqQueue.put_noblock(obj, *, retry: int = 1, wait_time: float = 0.001) with docstring, input validation (retry ∈ [0,10]), zmq.Again handling via retry loop/sleep, and error logging on exhaustion.
Call sites updated
tensorrt_llm/executor/proxy.py, tensorrt_llm/llmapi/mpi_session.py
Updated put_noblock calls to pass retry (shutdown: retry=4; mpi results: retry=2); call-site control flow unchanged aside from retry usage.
Test list regrouping
tests/integration/test_lists/test-db/l0_a10.yml
Moved six llmapi unit tests from the CPP section into the PyTorch section (no test code changes).

Sequence Diagram(s)

sequenceDiagram
  participant Caller as Proxy / MPI Session
  participant Q as ZeroMqQueue
  Caller->>Q: put_noblock(obj, retry=N, wait_time=dt)
  loop up to N attempts
    Q->>Q: try non-blocking send
    alt send succeeds
      Q-->>Caller: return
    else zmq.Again
      Q->>Q: sleep(wait_time)
    else other error
      Q-->>Caller: raise
    end
  end
  Q-->>Caller: log error if exhausted
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Release Blocker

Suggested reviewers

  • niukuo
  • chzblych
  • StanleySun639
  • litaotju
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Superjomn Superjomn requested review from litaotju and removed request for brb-nv and kaiyux August 19, 2025 02:56
@Superjomn
Copy link
Collaborator Author

/bot run

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: 1

🧹 Nitpick comments (2)
tensorrt_llm/executor/ipc.py (1)

128-142: Docstring needs style fix (Ruff D205) and clarity on error semantics

  • Add a blank line after the summary per D205.
  • Clarify that only zmq.Again (EAGAIN) is retried/suppressed; other exceptions propagate.

Apply this diff to update the docstring:

-    '''
-        Put an object into the queue without blocking, and retry if the send fails.
-        NOTE: It won't raise any error if the send fails.
-
-        Parameters:
-            obj (Any): The object to send.
-            retry (int): The number of times to retry sending the object.
-            wait_time (float): The time to wait before retrying.
-        '''
+    '''
+    Put an object into the queue without blocking, retrying on EAGAIN.
+
+    Only zmq.Again (EAGAIN) is retried and suppressed here; other exceptions are propagated.
+
+    Args:
+        obj (Any): The object to send.
+        retry (int): Number of retry attempts on EAGAIN (0 means single try). Must be between 0 and 2000.
+        wait_time (float): Sleep time in seconds between retries.
+    '''
tensorrt_llm/llmapi/mpi_session.py (1)

438-444: Non-blocking send try/except is now redundant for EAGAIN

With the updated put_noblock that internally retries and swallows EAGAIN (logging on exhaustion), this surrounding try/except won’t see EAGAIN anymore. Keeping it is harmless, but you could remove it or narrow it to non-EAGAIN errors if desired.

Optionally simplify to:

self.queue.put_noblock(self.results, retry=2)

If you want to preserve handling of non-EAGAIN ZMQError, you can catch and re-raise only when e.errno != zmq.EAGAIN, though put_noblock already re-raises non-EAGAIN in the suggested refactor.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cd1b809 and a7411f1.

📒 Files selected for processing (4)
  • tensorrt_llm/executor/ipc.py (1 hunks)
  • tensorrt_llm/executor/proxy.py (1 hunks)
  • tensorrt_llm/llmapi/mpi_session.py (1 hunks)
  • tests/integration/test_lists/test-db/l0_a10.yml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • tensorrt_llm/llmapi/mpi_session.py
  • tensorrt_llm/executor/ipc.py
  • tensorrt_llm/executor/proxy.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

  • tensorrt_llm/llmapi/mpi_session.py
  • tensorrt_llm/executor/ipc.py
  • tensorrt_llm/executor/proxy.py
🧠 Learnings (1)
📚 Learning: 2025-07-28T17:06:08.621Z
Learnt from: moraxu
PR: NVIDIA/TensorRT-LLM#6303
File: tests/integration/test_lists/qa/examples_test_list.txt:494-494
Timestamp: 2025-07-28T17:06:08.621Z
Learning: In TensorRT-LLM testing, it's common to have both CLI flow tests (test_cli_flow.py) and PyTorch API tests (test_llm_api_pytorch.py) for the same model. These serve different purposes: CLI flow tests validate the traditional command-line workflow, while PyTorch API tests validate the newer LLM API backend. Both are legitimate and should coexist.

Applied to files:

  • tests/integration/test_lists/test-db/l0_a10.yml
🧬 Code Graph Analysis (2)
tensorrt_llm/executor/ipc.py (2)
tensorrt_llm/_utils.py (1)
  • nvtx_range_debug (864-888)
tensorrt_llm/logger.py (1)
  • error (125-126)
tensorrt_llm/executor/proxy.py (1)
tensorrt_llm/executor/ipc.py (1)
  • put_noblock (125-152)
🪛 Ruff (0.12.2)
tensorrt_llm/executor/ipc.py

130-137: 1 blank line required between summary line and description

(D205)

⏰ 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 (2)
tests/integration/test_lists/test-db/l0_a10.yml (1)

37-43: Re-categorizing llmapi tests under PyTorch confirmed

The unittest/llmapi/* tests now appear exactly once under the PyTorch backend and are not present in any CPP blocks. Everything looks correct.

tensorrt_llm/executor/proxy.py (1)

352-352: Adding retry for shutdown sentinel is a good resilience improvement

Using retry=4 reduces spurious shutdown failures when the worker queue is temporarily busy.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15693 [ run ] triggered by Bot

@Superjomn
Copy link
Collaborator Author

/bot run

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

♻️ Duplicate comments (1)
tensorrt_llm/executor/ipc.py (1)

150-157: Replace recursive retry with an iterative loop and avoid logging full object contents

Recursion adds stack overhead and re-enters the function (re-pickling/signing on each attempt via the recursive call), and logging the entire object risks huge logs/PII leakage. An iterative loop is simpler, avoids repeated serialization, and logs concise context.

             if self.use_hmac_encryption:
                 data = self._sign_data(data)
-            try:
-                self.socket.send(data, flags=zmq.NOBLOCK)
-            except zmq.Again:
-                if retry > 0:
-                    time.sleep(wait_time)
-                    self.put_noblock(obj, retry=retry - 1, wait_time=wait_time)
-                else:
-                    logger.error(f"Failed to send object: {obj}")
+            attempts = retry + 1  # initial try + retries
+            for i in range(attempts):
+                try:
+                    self.socket.send(data, flags=zmq.NOBLOCK)
+                    break
+                except zmq.Again:
+                    if i < attempts - 1:
+                        time.sleep(wait_time)
+                        continue
+                    logger.error(
+                        f"put_noblock failed after {attempts} attempts "
+                        f"(queue={self.name}, socket={self.socket_type_str.get(self.socket_type, self.socket_type)}, "
+                        f"obj_type={type(obj).__name__}, bytes={len(data)})"
+                    )
+                except zmq.ZMQError:
+                    # Propagate non-EAGAIN ZMQ errors to caller
+                    raise
🧹 Nitpick comments (3)
tensorrt_llm/executor/ipc.py (3)

133-141: Docstring: fix D205, switch to Google style, and clarify which errors are suppressed

  • Ruff D205: add a blank line after the one-line summary.
  • Repo guideline: use Google-style docstrings (“Args”, “Returns”).
  • Clarify behavior: only EAGAIN (would-block) is suppressed; pickling or other ZMQ errors can still bubble up.

Apply:

-        '''
-        Put an object into the queue without blocking, and retry if the send fails.
-        NOTE: It won't raise any error if the send fails.
-
-        Parameters:
-            obj (Any): The object to send.
-            retry (int): The number of times to retry sending the object.
-            wait_time (float): The time to wait before retrying.
-        '''
+        '''
+        Put an object into the queue without blocking.
+
+        Retries on EAGAIN (would block) up to `retry` times with `wait_time` seconds between attempts.
+        Only EAGAIN is suppressed; serialization errors or other ZMQ errors may propagate.
+
+        Args:
+            obj (Any): The object to send.
+            retry (int): Number of retry attempts after the initial try. Must be between 0 and 10.
+            wait_time (float): Seconds to wait before each retry.
+
+        Returns:
+            None
+        '''

143-143: Avoid assert for argument validation; raise ValueError instead

asserts can be stripped with -O and won’t validate in production. Prefer explicit checks with exceptions.

-        assert retry >= 0 and retry <= 10, "Retry must be between 0 and 10, adjust the wait_time if needed"
+        if not (0 <= retry <= 10):
+            raise ValueError("retry must be between 0 and 10; increase wait_time instead of large retry counts")

1-2: Missing NVIDIA copyright header

Per repo guidelines, prepend the NVIDIA copyright header (current year).

+# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a7411f1 and d7cafad.

📒 Files selected for processing (2)
  • tensorrt_llm/executor/ipc.py (1 hunks)
  • tests/integration/test_lists/test-db/l0_a10.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/integration/test_lists/test-db/l0_a10.yml
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+
Python indentation: 4 spaces, no tabs
Maintain module namespace in imports (from package.subpackage import foo; then use foo.SomeClass())
Python file names use snake_case
Python class names use PascalCase
Python functions/methods and local variables use snake_case; variables starting with a number get k_ prefix (e.g., k_99th_percentile)
Global variables use G_ prefixed UPPER_SNAKE_CASE (e.g., G_MY_GLOBAL)
Constants use UPPER_SNAKE_CASE in Python
Avoid shadowing variables from outer scopes in Python
Initialize all externally visible members of a Python class in init
Prefer docstrings for interfaces used outside a file; comments for local code
Use Google-style docstrings for classes and functions (Sphinx-parsable)
Document attributes/variables inline with short docstrings
Avoid reflection when simple alternatives exist (e.g., prefer explicit parameters over dict(**locals()))
In try/except, catch the narrowest exceptions possible
For duck-typing with try/except, keep try body minimal and put logic in else

Files:

  • tensorrt_llm/executor/ipc.py
**/*.{cpp,cxx,cc,cu,h,hpp,hxx,hh,cuh,py}

📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)

Prepend NVIDIA copyright header (current year) to all source files

Files:

  • tensorrt_llm/executor/ipc.py
🧬 Code Graph Analysis (1)
tensorrt_llm/executor/ipc.py (2)
tensorrt_llm/_utils.py (1)
  • nvtx_range_debug (864-888)
tensorrt_llm/logger.py (1)
  • error (125-126)
🪛 Ruff (0.12.2)
tensorrt_llm/executor/ipc.py

130-137: 1 blank line required between summary line and description

(D205)

⏰ 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/executor/ipc.py (1)

128-133: Good API: keyword-only retry/wait_time with sensible defaults

Making retry semantics keyword-only avoids accidental arg shifting and makes call sites clearer. Defaults look reasonable.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15695 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15693 [ run ] completed with state ABORTED

@Superjomn Superjomn enabled auto-merge (squash) August 19, 2025 03:34
@tensorrt-cicd
Copy link
Collaborator

PR_Github #15695 [ run ] completed with state SUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #199 completed with status: 'FAILURE'

Signed-off-by: Superjomn <[email protected]>
@Superjomn
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15793 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #15793 [ run ] completed with state SUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #215 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@Superjomn Superjomn merged commit e77ec06 into NVIDIA:release/1.0 Aug 21, 2025
4 checks passed
@Superjomn Superjomn deleted the fix-runtime-size branch August 21, 2025 00:35
yuanjingx87 pushed a commit that referenced this pull request Aug 28, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 5, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 5, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 6, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 6, 2025
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 7, 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.

3 participants