[ 
https://issues.apache.org/jira/browse/IMPALA-13230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17870602#comment-17870602
 ] 

ASF subversion and git services commented on IMPALA-13230:
----------------------------------------------------------

Commit 2b98e5fb95d9e892518af80af76b56992a8a6006 in impala's branch 
refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=2b98e5fb9 ]

IMPALA-13230: Dump stacktrace for impala-shell when it receives SIGUSR1

It can be useful to get a stacktrace for a running impala-shell
for debugging. This uses Python 3's faulthandler to handle the
SIGUSR1, so it prints a stacktrace for all threads when it
receives SIGUSR1.

This does not implement an equivalent functionality for Python 2.
Python 2 doesn't have the faulthandler library, and hand tests
showed that sending SIGUSR1 to Python 2 impala-shell can interrupt
network calls and abort a running query.

Testing:
 - Added a test that verifies the stacktrace is printed and a
   running query succeeds.

Change-Id: If7dae2686b65a1a4f02488abadca3b3c90e48bf1
Reviewed-on: http://gerrit.cloudera.org:8080/21611
Reviewed-by: Yida Wu <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Michael Smith <[email protected]>


> 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
>            Priority: Major
>
> 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)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to