temporalio / sdk-python

Temporal Python SDK
MIT License
457 stars 68 forks source link

Include stack trace on deadlock detection exception #595

Closed twin-drill closed 1 month ago

twin-drill commented 2 months ago

Use the workflow tid to capture the workflow thread's frame at the time of deadlock.

Added current_thread_id: Optional[int] and get_worker_ident(self) -> Optional[int] to interfaces/implementations.

Currently I only set tid in _run_once for the standard implementation, if it's needed elsewhere please let me know. (This is mainly why it's marked as a draft)

Also, readability around the code in _workflow.py is (imo) suboptimal so I'd appreciate feedback/ideas on that.

twin-drill commented 2 months ago

needs at least a cleanup before we pull but I do want to make sure the tid is set where it needs to be set, and secondarily if there are ways to make building the traceback easier/more readable.