Skip to content

[https://nvbugs/5989923][fix] fix test_py_cache_transceiver_mp#12584

Open
chuangz0 wants to merge 2 commits intoNVIDIA:mainfrom
chuangz0:fix_mp_transceiver
Open

[https://nvbugs/5989923][fix] fix test_py_cache_transceiver_mp#12584
chuangz0 wants to merge 2 commits intoNVIDIA:mainfrom
chuangz0:fix_mp_transceiver

Conversation

@chuangz0
Copy link
Copy Markdown
Collaborator

@chuangz0 chuangz0 commented Mar 30, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved test resilience by implementing retry logic (up to 5 attempts) to handle port binding collisions during transceiver operations, automatically rediscovering available ports on each retry.
  • Tests

    • Removed waiver entries for three previously skipped parameterized test cases, reflecting improved test reliability and consistent passage.

Description

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

To see a list of available CI bot commands, please comment /bot help.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

The PR removes three test waive entries and enhances a test function with retry logic to handle MASTER_PORT bind collisions. The modified test function now attempts up to 5 spawns, rediscovering a free port on each retry and checking for address-in-use errors before deciding to retry or raise an exception.

Changes

Cohort / File(s) Summary
Waive-list entries
tests/integration/test_lists/waives.txt
Removed three SKIP entries for parameterized test_v2_transceiver_mp test cases (v2_mp_tp1_pp2_to_tp1_pp2, v2_mp_tp1_pp1_to_tp1_pp2, v2_mp_tp2_pp1_to_tp2_pp1).
Test function enhancement
tests/unittest/disaggregated/test_py_cache_transceiver_mp.py
Updated run_v2_transceiver_mp with retry logic to handle MASTER_PORT bind collisions; performs up to 5 spawn attempts with newly discovered free ports on each iteration, catching and checking for EADDRINUSE errors.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is empty except for the template placeholder comments and a checked checklist item; it lacks actual implementation details, issue explanation, solution description, and test coverage specifics. Fill in the Description section to explain the issue and solution, and provide specific test coverage details that safeguard the changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly indicates a fix for test_py_cache_transceiver_mp and follows the template format with NVBugs ID and [fix] type.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/unittest/disaggregated/test_py_cache_transceiver_mp.py`:
- Around line 1064-1074: The retry loop currently uses a broad `except Exception
as e`; narrow this to the specific bind-related error type (e.g. `except OSError
as e:` or `except (OSError, socket.error) as e:`) and then detect
`errno.EADDRINUSE` (using `import errno`) or fall back to the existing message
check; keep assigning `last_exc = e` for diagnostics, only perform the
port-retry logic when the error is the EADDRINUSE bind error, and re-raise all
other exceptions immediately. Reference symbols: the retry block variables
`master_port`, `attempt`, `max_retries`, and `last_exc` in
test_py_cache_transceiver_mp.py.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ee2fea32-e981-4e4e-8dd5-3ef2140625ea

📥 Commits

Reviewing files that changed from the base of the PR and between f0b336e and 3e63ce6.

📒 Files selected for processing (2)
  • tests/integration/test_lists/waives.txt
  • tests/unittest/disaggregated/test_py_cache_transceiver_mp.py
💤 Files with no reviewable changes (1)
  • tests/integration/test_lists/waives.txt

Comment on lines +1064 to +1074
except Exception as e:
last_exc = e
if "EADDRINUSE" in str(e) or "address already in use" in str(e).lower():
if attempt < max_retries - 1:
print(
f"Port {master_port} already in use, retrying with a new port "
f"(attempt {attempt + 1}/{max_retries})...",
flush=True,
)
continue
raise
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Narrow the retry except clause to specific exception types.

except Exception as e is too broad here and can accidentally treat unrelated failures as retriable. Restrict the catch to expected bind-related exception types and keep non-bind failures fail-fast.

Proposed patch
+import errno
@@
-        except Exception as e:
+        except (OSError, RuntimeError) as e:
             last_exc = e
-            if "EADDRINUSE" in str(e) or "address already in use" in str(e).lower():
+            err_no = e.errno if isinstance(e, OSError) else None
+            msg = str(e).lower()
+            is_addr_in_use = (
+                err_no == errno.EADDRINUSE
+                or "eaddrinuse" in msg
+                or "address already in use" in msg
+            )
+            if is_addr_in_use:
                 if attempt < max_retries - 1:
                     print(
                         f"Port {master_port} already in use, retrying with a new port "
                         f"(attempt {attempt + 1}/{max_retries})...",
                         flush=True,
                     )
                     continue
             raise

As per coding guidelines "Avoid broad exception handling — catch specific exceptions, not bare except: (see CODING_GUIDELINES.md).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/unittest/disaggregated/test_py_cache_transceiver_mp.py` around lines
1064 - 1074, The retry loop currently uses a broad `except Exception as e`;
narrow this to the specific bind-related error type (e.g. `except OSError as e:`
or `except (OSError, socket.error) as e:`) and then detect `errno.EADDRINUSE`
(using `import errno`) or fall back to the existing message check; keep
assigning `last_exc = e` for diagnostics, only perform the port-retry logic when
the error is the EADDRINUSE bind error, and re-raise all other exceptions
immediately. Reference symbols: the retry block variables `master_port`,
`attempt`, `max_retries`, and `last_exc` in test_py_cache_transceiver_mp.py.

@chuangz0
Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40698 [ run ] triggered by Bot. Commit: 3e63ce6 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40698 [ run ] completed with state SUCCESS. Commit: 3e63ce6
/LLM/main/L0_MergeRequest_PR pipeline #31726 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@chuangz0
Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40845 [ run ] triggered by Bot. Commit: 3e63ce6 Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40845 [ run ] completed with state SUCCESS. Commit: 3e63ce6
/LLM/main/L0_MergeRequest_PR pipeline #31854 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

@chuangz0 chuangz0 force-pushed the fix_mp_transceiver branch from 3e63ce6 to a4b454e Compare March 31, 2026 10:45
@chuangz0
Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40931 [ run ] triggered by Bot. Commit: a4b454e Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #40931 [ run ] completed with state FAILURE. Commit: a4b454e
/LLM/main/L0_MergeRequest_PR pipeline #31924 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

chuangz0 added 2 commits April 1, 2026 09:10
Signed-off-by: Chuang Zhu <111838961+chuangz0@users.noreply.github.com>
Signed-off-by: Chuang Zhu <111838961+chuangz0@users.noreply.github.com>
@chuangz0 chuangz0 force-pushed the fix_mp_transceiver branch from a4b454e to 39e74ad Compare April 1, 2026 01:10
@chuangz0
Copy link
Copy Markdown
Collaborator Author

chuangz0 commented Apr 1, 2026

/bot run --disable-fail-fast

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41052 [ run ] triggered by Bot. Commit: 39e74ad Link to invocation

@tensorrt-cicd
Copy link
Copy Markdown
Collaborator

PR_Github #41052 [ run ] completed with state FAILURE. Commit: 39e74ad
/LLM/main/L0_MergeRequest_PR pipeline #32028 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Link to invocation

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.

2 participants