Files
impala/www/jvm-threadz.tmpl
Joe McDonnell 6570c05fd4 IMPALA-5392: Display full Java stacktraces in /jvm-threadz
jvm-threadz provides information about all the JVM
threads running in an Impalad/Catalogd. Currently, this
relies on ThreadInfo.toString() for a text representation
of the thread information and stack. This output only contains
the first few frames, which can be an issue for deeper stacks
(e.g. the Catalog talking to HMS via Thrift). The output does
contain useful non-stacktrace information like what lock the
thread is waiting on.

This keeps the first line of the ThreadInfo.toString() output
that contains non-stacktrace information. Then it walks through
the StackTraceElements from ThreadInfo.getStackTrace() and
adds the full stack string. This is intended to mimic
the jstack output (with indentation and "at").

To avoid licensing issues, I have not looked at any of the
OpenJDK code (which is GPL 2.0) or any of the previous attempts
at solving this issue (which consulted OpenJDK code).

To make the stacks display correctly in the WebUI page,
this puts the thread information in a <span> with
"white-space: pre-wrap", which respects the newlines in
the original output.

Testing:
 - gdb attached to the HMS and then issued a select in
   impala-shell to force a metadata load. Then, looked at
   the catalogd /jvm-threadz page to see the longer stacks.

Change-Id: I6730336600a8130e6452c682bcf249cac528ceee
Reviewed-on: http://gerrit.cloudera.org:8080/19632
Reviewed-by: Wenzhe Zhou <wzhou@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Quanlong Huang <huangquanlong@gmail.com>
2023-03-20 10:29:02 +00:00

68 lines
1.8 KiB
Cheetah

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
{{> www/common-header.tmpl }}
{{> www/threadz_tabs.tmpl }}
<h3>JVM Threads</h3>
{{#overview}}
<h3>Total: {{thread_count}}, Daemon: {{daemon_count}}, Peak: {{peak_count}}</h3>
{{/overview}}
<table id="java-threads-tbl" class='table table-hover table-bordered'>
<thead>
<tr>
<th>Summary</th>
<th>CPU time (s)</th>
<th>User time (s)</th>
<th>Blocked time (ms)</th>
<th>Blocked times</th>
<th>Native</th>
</tr>
</thead>
<tbody>
{{#jvm-threads}}
<tr>
<td><span style="white-space: pre-wrap;">{{summary}}</span></td>
<td>{{cpu_time_sec}}</td>
<td>{{user_time_sec}}</td>
<td>{{blocked_time_ms}}</td>
<td>{{blocked_count}}</td>
<td>{{is_native}}</td>
</tr>
{{/jvm-threads}}
</tbody>
</table>
<script>
$(document).ready(function() {
$('#java-threads-tbl').DataTable({
"order": [[ 1, "asc" ]],
"pageLength": 100
});
});
</script>
<script>
$("#jvm-tab").addClass("active");
</script>
{{> www/common-footer.tmpl }}