Joe McDonnell created IMPALA-13230: -------------------------------------- Summary: Add a way to dump stack traces for impala-shell while it is running Key: IMPALA-13230 URL: https://issues.apache.org/jira/browse/IMPALA-13230 Project: IMPALA Issue Type: Task Components: Clients Affects Versions: Impala 4.5.0 Reporter: Joe McDonnell
It can be useful to get the Python stack traces for impala-shell when it is stuck. There is a nice thread on Stack Overflow about how to do this: [https://stackoverflow.com/questions/132058/showing-the-stack-trace-from-a-running-python-application] One option is to install a signal handler for the SIGUSR1 signal and use that to dump a backtrace. I tried this and it works for Python 3 (but causes issues for running queries on Python 2): {noformat} # For debugging, it is useful to handle the SIGUSR1 symbol and use it to print a # stacktrace signal.signal(signal.SIGUSR1, lambda sid, stack: traceback.print_stack(stack)){noformat} Another option mentioned is the faulthandler module ([https://docs.python.org/dev/library/faulthandler.html|https://docs.python.org/dev/library/faulthandler.html)] ), which provides a way to do the same thing. The faulthandler module seems to be able to do this for all threads, not just the main thread. Either way, this would give us some options if we need to debug impala-shell out in the wild. -- This message was sent by Atlassian Jira (v8.20.10#820010)