[https://nvbugs/5989923][fix] fix test_py_cache_transceiver_mp#12584
[https://nvbugs/5989923][fix] fix test_py_cache_transceiver_mp#12584chuangz0 wants to merge 2 commits intoNVIDIA:mainfrom
Conversation
📝 WalkthroughWalkthroughThe PR removes three test waive entries and enhances a test function with retry logic to handle Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
tests/integration/test_lists/waives.txttests/unittest/disaggregated/test_py_cache_transceiver_mp.py
💤 Files with no reviewable changes (1)
- tests/integration/test_lists/waives.txt
| 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 |
There was a problem hiding this comment.
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
raiseAs 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.
|
/bot run |
|
PR_Github #40698 [ run ] triggered by Bot. Commit: |
|
PR_Github #40698 [ run ] completed with state
|
|
/bot run |
|
PR_Github #40845 [ run ] triggered by Bot. Commit: |
|
PR_Github #40845 [ run ] completed with state
|
3e63ce6 to
a4b454e
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #40931 [ run ] triggered by Bot. Commit: |
|
PR_Github #40931 [ run ] completed with state
|
Signed-off-by: Chuang Zhu <111838961+chuangz0@users.noreply.github.com>
a4b454e to
39e74ad
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #41052 [ run ] triggered by Bot. Commit: |
|
PR_Github #41052 [ run ] completed with state
|
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
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.