temporalio / sdk-python

Temporal Python SDK
MIT License
474 stars 77 forks source link

[Feature Request] Handle edge case of recursive exceptions in failure converter #697

Open yunmanger1 opened 13 hours ago

yunmanger1 commented 13 hours ago

Is your feature request related to a problem? Please describe.

It is kind of an easy mistake to do in python:

try:
    raise ValueError("test")
except Exception as e:
    raise e from e

The re-raised exception will have e.__cause__ referencing itself resulting in failure to serialize error and python sdk won't report anything resulting in retries and startToClose timeouts.

Describe the solution you'd like

Handle a case when e.__cause__ == e in DefaultFailureConverter. Created a dummy pull request #696

Additional context

https://temporalio.slack.com/archives/CTT84RS0P/p1719632201314119

cretz commented 13 hours ago

python sdk won't report anything

I think this is the primary bug. There are situations where recursion and stack overflow can occur in serialization, and the linked PR naively only helps the case of the cause being the same as itself (but if it was two causes deep that recursed, the issue would still appear). We just need to make it clear when it happens (or any other failure serialization happens).

If we are indeed not reporting anything, we need to fix that. #685 is related when failing to build a failure.