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

Joe McDonnell commented on IMPALA-13230:
----------------------------------------

Example stack trace while running a query:
{noformat}
  File "shell/build/python3_venv/bin/impala-shell", line 8, in <module>
    sys.exit(impala_shell_main())
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/impala_shell.py",
 line 2305, in impala_shell_main
    shell.cmdloop(intro)
  File "/usr/lib/python3.8/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/impala_shell.py",
 line 788, in onecmd
    return func(arg)
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/impala_shell.py",
 line 1239, in do_select
    return self._execute_stmt(query_str, print_web_link=True)
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/impala_shell.py",
 line 1426, in _execute_stmt
    for rows in rows_fetched:
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/impala_client.py",
 line 926, in fetch
    resp = self._do_hs2_rpc(FetchResults, req)
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/impala_client.py",
 line 1148, in _do_hs2_rpc
    rpc_output = rpc(rpc_input)
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/impala_client.py",
 line 920, in FetchResults
    return self.imp_service.FetchResults(req)
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/TCLIService/TCLIService.py",
 line 756, in FetchResults
    return self.recv_FetchResults()
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/impala_shell/TCLIService/TCLIService.py",
 line 768, in recv_FetchResults
    (fname, mtype, rseqid) = iprot.readMessageBegin()
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/thrift/protocol/TBinaryProtocol.py",
 line 134, in readMessageBegin
    sz = self.readI32()
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/thrift/protocol/TBinaryProtocol.py",
 line 217, in readI32
    buff = self.trans.readAll(4)
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/thrift/transport/TTransport.py",
 line 62, in readAll
    chunk = self.read(sz - have)
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/thrift/transport/TTransport.py",
 line 164, in read
    self.__rbuf = BufferIO(self.__trans.read(max(sz, self.__rbuf_size)))
  File 
"/home/joemcdonnell/upstream/Impala/shell/build/python3_venv/lib/python3.8/site-packages/thrift/transport/TSocket.py",
 line 150, in read
    buff = self.handle.recv(sz)
{noformat}

> 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: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to