TensorRT-LLM icon indicating copy to clipboard operation
TensorRT-LLM copied to clipboard

EngineDeadError message compounds a prefix each time it is unpickled

Open StephenLReed opened this issue 3 months ago • 1 comments

System Info

  • TensorRT-LLM: 1.3.0rc23 (built from f20ea652); behaviour re-checked against main @ fbda11f5
  • GPU: NVIDIA GeForce RTX 5090 (sm_120), driver 595.71.05
  • PyTorch 2.11.0+cu130, CUDA 13.0, Python 3.12.13
  • Ubuntu 25.10, kernel 6.17.0-41-generic
  • Backend: PyTorch; single GPU, no TP/PP
  • Model where observed: Qwen3.6-35B-A3B-NVFP4 with FP8 KV cache (where model-specific)

Who can help?

No response

Reproduction

EngineDeadError.__init__ renders root_cause into the message, and default exception pickling round-trips through args — which holds that rendered message. Unpickling re-invokes __init__ with the message string as the cause, so the prefix is prepended again on every hop:

original : Engine has died: RuntimeError: PyExecutor has already been shutdown
1 hop    : Engine has died: str: Engine has died: RuntimeError: PyExecutor has already been shutdown
2 hops   : Engine has died: str: Engine has died: str: Engine has died: RuntimeError: ...

The class is raised when a worker process dies, i.e. exactly where it crosses a process boundary, so the mangled text is the form users are most likely to encounter.

Expected behavior

An EngineDeadError reconstructed in another process renders the same message as the original.

actual behavior

Each unpickle prepends the prefix again, so the message grows one 'Engine has died: str: ' per hop. .root_cause is unaffected.

additional notes

Message only. __dict__ is restored after __init__, so .root_cause survives as the original exception and the attribute contract holds. This is log legibility and unbounded message growth, not a broken consumer contract.

Add __reduce__ returning (self.__class__, (self.root_cause,)) so reconstruction uses the cause rather than the rendered text. root_cause is already pickled as part of __dict__, so no new picklability requirement is introduced.

We have the patch with four CPU-only tests (2 fail before, 4 pass after) and are raising this Issue Request first per CONTRIBUTING.md.

Questions for maintainers

  1. Would you prefer __reduce__, or moving the rendering out of __init__ into __str__ so args never holds the formatted text?
  2. Are there other exception types in tensorrt_llm/executor that render constructor arguments into the message and would have the same issue?

StephenLReed avatar Aug 18 '26 16:08 StephenLReed

Hi maintainers,

I'd like to take this issue and work on a fix.

I will investigate the current EngineDeadError serialization behavior, implement the appropriate fix (likely via __reduce__), and add regression tests to prevent the message duplication issue during exception pickling/unpickling.

Please assign this issue to me if possible. I'll submit a PR once the changes are ready.

Thanks for reading.

Lunemere avatar Sep 25 '26 08:09 Lunemere