<#3310 feat: Add faulthandler registration for SIG...
# flyte-github
c
#3310 feat: Add faulthandler registration for SIGUSR1 Pull request opened by pingsutw ## Why are the changes needed? No log or stack trace when the task is hanging. ## What changes were proposed in this pull request? Register a signal handler, so that we can see the stacktrace when the task gets killed ## How was this patch tested? Run a task, and kill the pod. Locally,
Copy code
$ cat > x.py
import faulthandler
import signal
faulthandler.register(signal.SIGUSR1)
import asyncio
asyncio.run(asyncio.sleep(100))
^C
$ python x.py &
[1] 68306
$ kill -USR1 68306
Current thread 0x00000001f8b74c80 (most recent call first):
  File "/Users/ytong/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13/selectors.py", line 548 in select
  File %                                                                                                                                                                   "/Users/ytong/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13/asyncio/base_events.py", line 1995 in _run_once
  File "/Users/ytong/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13/asyncio/base_events.py", line 678 in run_forever
  File "/Users/ytong/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13/asyncio/base_events.py", line 707 in run_until_complete
  File "/Users/ytong/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13/asyncio/runners.py", line 118 in run
  File "/Users/ytong/.local/share/uv/python/cpython-3.13.1-macos-aarch64-none/lib/python3.13/asyncio/runners.py", line 194 in run
  File "/Users/ytong/x.py", line 5 in <module>
### Setup process ### Screenshots ## Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. ## Related PRs ## Docs link https://bito.ai#summarystart| ### Summary by Bito This pull request enhances signal handling in the Flytekit library by registering the faulthandler for SIGUSR1, enabling stack trace capture for better debugging when tasks hang or are terminated. flyteorg/flytekit