[
https://issues.apache.org/jira/browse/IMPALA-14876?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Smith resolved IMPALA-14876.
------------------------------------
Fix Version/s: Impala 5.0.0
Resolution: Fixed
> Use const char* for thread name in impala::Thread::SuperviseThread
> ------------------------------------------------------------------
>
> Key: IMPALA-14876
> URL: https://issues.apache.org/jira/browse/IMPALA-14876
> Project: IMPALA
> Issue Type: Improvement
> Components: Backend
> Reporter: Quanlong Huang
> Assignee: Quanlong Huang
> Priority: Critical
> Fix For: Impala 5.0.0
>
> Attachments: new-pstack.txt
>
>
> impala::Thread::SuperviseThread() runs most of the backend threads. Its first
> parameter is the thread name:
> {code:cpp}
> static void SuperviseThread(const std::string& name, const std::string&
> category,
> const ThreadFunctor& functor, const ThreadDebugInfo* parent_thread_info,
> Promise<int64_t>* thread_started);{code}
> In backtraces printed in pstack/gdb, the thread name is usually omitted as
> "name=...", e.g.
> {noformat}
> #39 impala::Thread::SuperviseThread(std::__cxx11::basic_string<char,
> std::char_traits<char>, std::allocator<char> > const&,
> std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>
> > const&, boost::function<void ()>, impala::ThreadDebugInfo const*,
> impala::Promise<long, (impala::PromiseMode)0>*) (name=..., category=...,
> functor=..., parent_thread_info=0x7f6bffa027f0,
> thread_started=0x7f6bffa01ac0) at thread.cc:360{noformat}
> It'd be helpful to print the thread name so we can directly find the thread
> of a given fragment instance. The first option is making the thread name be
> shown correctly:
> {noformat}
> Thread 1045 (Thread 0x7ff184860640 (LWP 1395025) "reacquire threa"):{noformat}
> However, pstack typically pulls the thread name from
> /proc/<pid>/task/<tid>/comm. Since the kernel only stores 15 characters
> there, pstack can only show 15 characters. That's not enough for fragment
> instance ids.
> The second option is changing the 'name' parameter type to const char* and
> make sure it's not optimized out. Then pstack will print its value in the
> backtrace.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)