Repository navigation
[#17910][fix] Keep the EngineDeadError message stable across pickle and copy - #20981
LeizhenZhang wants to merge 1 commit into
Conversation
…ckle and copy EngineDeadError formats its message from root_cause in __init__, and the default exception reduction rebuilds it from self.args, which holds that formatted message. Each pickle or copy therefore passed the message back in as the cause and prefixed "Engine has died: str: " again. Add __reduce__ that rebuilds the error from root_cause and keeps __dict__, and add CPU tests for pickle and copy round trips. Signed-off-by: LeizhenZhang <zhangleizhen645@gmail.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Exception reconstruction and coverage tensorrt_llm/executor/utils.py, tests/unittest/executor/test_proxy_fast_death.py |
__reduce__ supplies the class, root_cause, and instance dictionary for reconstruction. Tests check message and cause preservation across pickle round trips and copies. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Low
Merge Risk: 
Minimal · up to fb8b7
-
The change preserves EngineDeadError messages across serialization and copying, with regression coverage in CI.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Issue
#17910requires stable EngineDeadError messages after reconstruction across process boundaries.tensorrt_llm/executor/utils.pynow returns(self.__class__, (self.root_cause,), self.__dict__)from__reduce__, so reconstruction uses the original cause instead of the formattedself.argsmessage. The added tests intests/unittest/executor/test_proxy_fast_death.pyverify message and argument stability after one and two pickle hops, plus shallow and deep copy. The tests also verify the root-cause type and text.
Full details: Out of Scope Changes check
-
Explanation
The pull request changes only
EngineDeadError.__reduce__and adds focused pickle and copy tests for Issue#17910. The implementation preservesself.__dict__, includingroot_cause, and the tests directly cover the requested message behavior. No unrelated production behavior or unrelated tests appear in the whole-pull-request diff.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Generated by an AI-assisted triage bot; please correct any mistaken assumptions. Your fix keeps the error message readable across pickle and copy, and the new tests directly cover that behavior. The demonstrated improvement is limited to diagnostic stability: the exception and its root cause already survive, and the engine-death handling still follows the same terminal failure path. Based on the assessment above, we're giving this PR lower review priority for now and adding A concrete downstream use where stable exception messages restore recovery or another functional behavior beyond clearer reporting would warrant reconsideration. You're welcome to reply, update the PR description, or request maintainer review; a code change is not necessarily required. If there is no further activity for 14 days, this PR will be automatically closed. |
|
Thanks for the assessment, it is accurate. I checked The change is small (a 6-line |
Dev Engineer Review
EngineDeadError.__reduce__reconstructs the exception fromroot_causeand restoresself.__dict__. This prevents the formatted message inargsfrom being passed back into__init__, while preserving the root-cause attribute. No unrelated source changes are reported. Test execution status is not available.QA Engineer Review
Modified
tests/unittest/executor/test_proxy_fast_death.py. The new tests check pickle round trips with and without a cause, a second pickle hop, and shallow and deep copies. They verify message stability,args, and root-cause type and text. The test file is listed intests/integration/test_lists/test-db/l0_a10.yml; no manual-QA listing was found. Coverage verdict: sufficient for the reported message-stability behavior.Per-File QA Perspective
tensorrt_llm/executor/utils.py: Verify that pickling and copying preserve the rendered message androot_cause. The new reduction method also applies to subclasses throughself.__class__.tests/unittest/executor/test_proxy_fast_death.py: Tests message stability across pickle and copy operations, including repeated pickling and aNonecause. Listed in the CI test list attests/integration/test_lists/test-db/l0_a10.yml.Description
Fixes #17910.
Thanks to @StephenLReed for the detailed report. @Lunemere offered to take this issue on 2026-09-25. I have not seen a PR from either of you yet, so here is a small fix. I am glad to close this in favor of yours if you already have one in progress.
EngineDeadErrorformats its message in__init__fromroot_causeand passes that text toRuntimeError.__init__. The default exception reduction rebuilds an exception ascls(*self.args). ForEngineDeadErrorthat means the formatted message comes back in asroot_cause, so every pickle or copy prefixes it once more.Reproduction on current main (CPU only):
Output before this change:
A second pickle adds a third prefix, and so on.
EngineDeadError()with no cause turns intoEngine has died: str: Engine has died.root_causeitself survives because__dict__is restored after__init__, so only the message is affected. The error is the one users see when a worker dies. On main it is raised in the proxy and handled in the same process, so the growing prefix shows up when code passes it to another process or copies it, for example user code or a deployment that forwards errors overmultiprocessing. Sending it from a forked child to its parent over amultiprocessing.Pipeshows the doubled prefix in the parent.Root cause:
tensorrt_llm/executor/utils.py,EngineDeadError.__init__stores the formatted text inself.args, and the class has no__reduce__, soBaseException.__reduce__returns(cls, self.args, self.__dict__).Fix: add
EngineDeadError.__reduce__that returns(self.__class__, (self.root_cause,), self.__dict__). Reconstruction now goes through__init__with the original cause and produces the same message once. Keepingself.__dict__in the tuple matches the default reduction, soroot_causeand any other instance attributes (for example notes added withadd_note) still round trip.self.argsandstr(err)are unchanged for code that creates the error directly.Test Coverage
tests/unittest/executor/test_proxy_fast_death.py:test_engine_dead_error_pickle_round_trip_keeps_message[cause0]and[None]: one and two pickle hops keepstr(),args, and theroot_causetype and text.test_engine_dead_error_copy_keeps_message:copy.copyandcopy.deepcopykeep the message androot_cause.The three new cases fail on current main and pass with this change. The other tests in the file give the same results before and after the change.
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)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.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.