You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
arthas/en/thread.html

537 lines
31 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>thread &mdash; Arthas ${revision} documentation</title>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/overrides.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="jvm" href="jvm.html" />
<link rel="prev" title="dashboard" href="dashboard.html" />
<script>
if (window.location.href.startsWith("https://alibaba.github.io/arthas/")) {
window.location.href = "https://arthas.aliyun.com/doc/" + window.location.href.substr("https://alibaba.github.io/arthas/".length);
}
</script>
<script src="_static/center_page.js"></script>
<link rel="stylesheet" href="https://g.alicdn.com/code/lib/highlight.js/9.13.1/styles/github.min.css">
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Arthas
</a>
<div class="version">
${revision}
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference external" href="https://arthas.aliyun.com/">Home</a></li>
<li class="toctree-l1"><a class="reference external" href="https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en">Online tutorials(Recommend)</a></li>
<li class="toctree-l1"><a class="reference internal" href="install-detail.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="download.html">Download</a></li>
<li class="toctree-l1"><a class="reference internal" href="quick-start.html">Quick start</a></li>
<li class="toctree-l1"><a class="reference internal" href="advanced-use.html">Advanced usage</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="commands.html">Commands</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="dashboard.html">dashboard</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">thread</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#parameters">Parameters</a></li>
<li class="toctree-l3"><a class="reference internal" href="#how-the-cpu-ratios-are-calculated">How the CPU ratios are calculated?</a></li>
<li class="toctree-l3"><a class="reference internal" href="#usage">Usage</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#list-the-top-n-busiest-threads-with-detailed-stack-trace">List the top n busiest threads with detailed stack trace</a></li>
<li class="toctree-l4"><a class="reference internal" href="#list-first-page-threads-info-when-no-options-provided">List first page threads info when no options provided</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thread-all-show-all-matching-threads">thread all, show all matching threads</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thread-id-show-the-running-stack-for-the-target-thread">thread id, show the running stack for the target thread</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thread-b-locate-the-thread-bocking-the-others">thread -b, locate the thread bocking the others</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thread-i-specify-the-sampling-interval">thread -i, specify the sampling interval</a></li>
<li class="toctree-l4"><a class="reference internal" href="#thread-state-view-the-special-state-theads">thread state , view the special state theads</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="jvm.html">jvm</a></li>
<li class="toctree-l2"><a class="reference internal" href="sysprop.html">sysprop</a></li>
<li class="toctree-l2"><a class="reference internal" href="sysenv.html">sysenv</a></li>
<li class="toctree-l2"><a class="reference internal" href="vmoption.html">vmoption</a></li>
<li class="toctree-l2"><a class="reference internal" href="perfcounter.html">perfcounter</a></li>
<li class="toctree-l2"><a class="reference internal" href="logger.html">logger</a></li>
<li class="toctree-l2"><a class="reference internal" href="mbean.html">mbean</a></li>
<li class="toctree-l2"><a class="reference internal" href="getstatic.html">getstatic</a></li>
<li class="toctree-l2"><a class="reference internal" href="ognl.html">ognl</a></li>
<li class="toctree-l2"><a class="reference internal" href="sc.html">sc</a></li>
<li class="toctree-l2"><a class="reference internal" href="sm.html">sm</a></li>
<li class="toctree-l2"><a class="reference internal" href="dump.html">dump</a></li>
<li class="toctree-l2"><a class="reference internal" href="heapdump.html">heapdump</a></li>
<li class="toctree-l2"><a class="reference internal" href="jad.html">jad</a></li>
<li class="toctree-l2"><a class="reference internal" href="classloader.html">classloader</a></li>
<li class="toctree-l2"><a class="reference internal" href="mc.html">mc</a></li>
<li class="toctree-l2"><a class="reference internal" href="redefine.html">redefine</a></li>
<li class="toctree-l2"><a class="reference internal" href="monitor.html">monitor</a></li>
<li class="toctree-l2"><a class="reference internal" href="watch.html">watch</a></li>
<li class="toctree-l2"><a class="reference internal" href="trace.html">trace</a></li>
<li class="toctree-l2"><a class="reference internal" href="stack.html">stack</a></li>
<li class="toctree-l2"><a class="reference internal" href="tt.html">tt</a></li>
<li class="toctree-l2"><a class="reference internal" href="profiler.html">profiler</a></li>
<li class="toctree-l2"><a class="reference internal" href="cat.html">cat</a></li>
<li class="toctree-l2"><a class="reference internal" href="echo.html">echo</a></li>
<li class="toctree-l2"><a class="reference internal" href="grep.html">grep</a></li>
<li class="toctree-l2"><a class="reference internal" href="tee.html">tee</a></li>
<li class="toctree-l2"><a class="reference internal" href="pwd.html">pwd</a></li>
<li class="toctree-l2"><a class="reference internal" href="options.html">options</a></li>
<li class="toctree-l2"><a class="reference internal" href="commands.html#basic-arthas-commands">Basic Arthas Commands</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="web-console.html">WebConsole</a></li>
<li class="toctree-l1"><a class="reference internal" href="tunnel.html">Arthas Tunnel</a></li>
<li class="toctree-l1"><a class="reference internal" href="http-api.html">Http API</a></li>
<li class="toctree-l1"><a class="reference internal" href="docker.html">Docker</a></li>
<li class="toctree-l1"><a class="reference internal" href="spring-boot-starter.html">Arthas Spring Boot Starter</a></li>
<li class="toctree-l1"><a class="reference internal" href="idea-plugin.html">IDEA Plugin</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Auser-case">User cases</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/issues?q=label%3Aquestion-answered">Questions and answers</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas">Fork me at GitHub</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/blob/master/CONTRIBUTING.md#">Compile and debug/CONTRIBUTING</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/alibaba/arthas/releases">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="contact-us.html">Contact us</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Arthas</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li><a href="commands.html">All Commands</a> &raquo;</li>
<li>thread</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/alibaba/arthas/blob/master/site/src/site/sphinx/en/thread.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="thread">
<h1>thread<a class="headerlink" href="#thread" title="Permalink to this headline"></a></h1>
<p><a class="reference external" href="https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&amp;id=command-thread"><code class="docutils literal notranslate"><span class="pre">thread</span></code> online tutorial</a></p>
<blockquote>
<div><p>Check the basic info and stack trace of the target thread.</p>
</div></blockquote>
<div class="section" id="parameters">
<h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline"></a></h2>
<table border="1" class="docutils">
<thead>
<tr>
<th align="right">Name</th>
<th align="left">Specification</th>
</tr>
</thead>
<tbody>
<tr>
<td align="right"><em>id</em></td>
<td align="left">thread id in JVM</td>
</tr>
<tr>
<td align="right"><code>[n:]</code></td>
<td align="left">the top n busiest threads with stack traces printed</td>
</tr>
<tr>
<td align="right"><code>[b]</code></td>
<td align="left">locate the thread blocking the others</td>
</tr>
<tr>
<td align="right">[i <code>&lt;value&gt;</code>]</td>
<td align="left">specify the interval to collect data to compute CPU ratios (ms)</td>
</tr>
<tr>
<td align="right">[--all]</td>
<td align="left">Show all matching threads</td>
</tr>
</tbody>
</table></div>
<div class="section" id="how-the-cpu-ratios-are-calculated">
<h2>How the CPU ratios are calculated?<a class="headerlink" href="#how-the-cpu-ratios-are-calculated" title="Permalink to this headline"></a></h2>
<p>The cpu ratios here is similar to the thread <code class="docutils literal notranslate"><span class="pre">%CPU</span></code> of the linux command <code class="docutils literal notranslate"><span class="pre">top</span> <span class="pre">-H</span> <span class="pre">-p</span> <span class="pre">&lt;pid&gt;</span></code>. During a sampling interval,
the ratio of the incremental cpu time of each thread in the current JVM to the sampling interval time.</p>
<blockquote>
<div><p>Working principle description:</p>
</div></blockquote>
<ul class="simple">
<li><p>Do the first sampling, get the CPU time of all threads ( by calling <code class="docutils literal notranslate"><span class="pre">java.lang.management.ThreadMXBean#getThreadCpuTime()</span></code> and
<code class="docutils literal notranslate"><span class="pre">sun.management.HotspotThreadMBean.getInternalThreadCpuTimes()</span></code> )</p></li>
<li><p>Sleep and wait for an interval (the default is 200ms, the interval can be specified by <code class="docutils literal notranslate"><span class="pre">-i</span></code>)</p></li>
<li><p>Do the second sampling, get the CPU time of all threads, compare the two sampling data, and calculate the incremental CPU time of each thread</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">Thread</span> <span class="pre">CPU</span> <span class="pre">usage</span> <span class="pre">ratio</span></code> = <code class="docutils literal notranslate"><span class="pre">Thread</span> <span class="pre">increment</span> <span class="pre">CPU</span> <span class="pre">time</span></code> / <code class="docutils literal notranslate"><span class="pre">Sampling</span> <span class="pre">interval</span> <span class="pre">time</span></code> * 100%</p></li>
</ul>
<blockquote>
<div><p>Note: this operation consumes CPU time too (<code class="docutils literal notranslate"><span class="pre">getThreadCpuTime</span></code> is time-consuming), therefore it is possible to observe Arthass thread appears in the list. To avoid this, try to increase sample interval, for example: 5000 ms.<br/></p>
</div></blockquote>
<blockquote>
<div><p>Another way to view the thread cpu usage of the Java process, <a class="reference external" href="https://github.com/oldratlee/useful-scripts/blob/master/docs/java.md#-show-busy-java-threads">show-busy-java-threads</a> can come to help.</p>
</div></blockquote>
</div>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<div class="section" id="list-the-top-n-busiest-threads-with-detailed-stack-trace">
<h3>List the top n busiest threads with detailed stack trace<a class="headerlink" href="#list-the-top-n-busiest-threads-with-detailed-stack-trace" title="Permalink to this headline"></a></h3>
<div class="highlight-shell notranslate"><div class="highlight hljs"><pre class="shell">$ thread -n 3
&quot;C1 CompilerThread0&quot; [Internal] cpuUsage=1.63% deltaTime=3ms time=1170ms
&quot;arthas-command-execute&quot; Id=23 cpuUsage=0.11% deltaTime=0ms time=401ms RUNNABLE
at java.management@11.0.7/sun.management.ThreadImpl.dumpThreads0(Native Method)
at java.management@11.0.7/sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:466)
at com.taobao.arthas.core.command.monitor200.ThreadCommand.processTopBusyThreads(ThreadCommand.java:199)
at com.taobao.arthas.core.command.monitor200.ThreadCommand.process(ThreadCommand.java:122)
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.process(AnnotatedCommandImpl.java:82)
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.access$100(AnnotatedCommandImpl.java:18)
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:111)
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:108)
at com.taobao.arthas.core.shell.system.impl.ProcessImpl$CommandProcessTask.run(ProcessImpl.java:385)
at java.base@11.0.7/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base@11.0.7/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base@11.0.7/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base@11.0.7/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base@11.0.7/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base@11.0.7/java.lang.Thread.run(Thread.java:834)
&quot;VM Periodic Task Thread&quot; [Internal] cpuUsage=0.07% deltaTime=0ms time=584ms</pre></div>
</div>
<ul class="simple">
<li><p>Without thread ID, including <code class="docutils literal notranslate"><span class="pre">[Internal]</span></code> means JVM internal thread, refer to the introduction of <a class="reference internal" href="dashboard.html"><span class="doc">dashboard</span></a> command.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cpuUsage</span></code> is the CPU usage of the thread during the sampling interval, consistent with the data of the <a class="reference internal" href="dashboard.html"><span class="doc">dashboard</span></a> command.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">deltaTime</span></code> is the incremental CPU time of the thread during the sampling interval. If it is less than 1ms, it will be rounded and displayed as 0ms.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">time</span></code> The total CPU time of thread.</p></li>
</ul>
<p><strong>Note:</strong> The thread stack is acquired at the end of the second sampling, which does not indicate that the thread is
processing the same task during the sampling interval. It is recommended that the interval time should not be too long.
The larger the interval time, the more inaccurate.</p>
<p>You can try to specify different intervals according to the specific situation and observe the output results.</p>
</div>
<div class="section" id="list-first-page-threads-info-when-no-options-provided">
<h3>List first page threads info when no options provided<a class="headerlink" href="#list-first-page-threads-info-when-no-options-provided" title="Permalink to this headline"></a></h3>
<p>By default, they are arranged in descending order of CPU increment time, and only the first page of data is displayed.</p>
<div class="highlight-shell notranslate"><div class="highlight hljs"><pre class="shell">$ thread
Threads Total: 33, NEW: 0, RUNNABLE: 9, BLOCKED: 0, WAITING: 3, TIMED_WAITING: 4, TERMINATED: 0, Internal threads: 17
ID NAME GROUP PRIORITY STATE %CPU DELTA_TIME TIME INTERRUPT DAEMON
-1 C2 CompilerThread0 - -1 - 5.06 0.010 0:0.973 false true
-1 C1 CompilerThread0 - -1 - 0.95 0.001 0:0.603 false true
23 arthas-command-execute system 5 RUNNABLE 0.17 0.000 0:0.226 false true
-1 VM Periodic Task Thread - -1 - 0.05 0.000 0:0.094 false true
-1 Sweeper thread - -1 - 0.04 0.000 0:0.011 false true
-1 G1 Young RemSet Sampling - -1 - 0.02 0.000 0:0.025 false true
12 Attach Listener system 9 RUNNABLE 0.0 0.000 0:0.022 false true
11 Common-Cleaner InnocuousThrea 8 TIMED_WAI 0.0 0.000 0:0.000 false true
3 Finalizer system 8 WAITING 0.0 0.000 0:0.000 false true
2 Reference Handler system 10 RUNNABLE 0.0 0.000 0:0.000 false true
4 Signal Dispatcher system 9 RUNNABLE 0.0 0.000 0:0.000 false true
15 arthas-NettyHttpTelnetBootstra system 5 RUNNABLE 0.0 0.000 0:0.029 false true
22 arthas-NettyHttpTelnetBootstra system 5 RUNNABLE 0.0 0.000 0:0.196 false true
24 arthas-NettyHttpTelnetBootstra system 5 RUNNABLE 0.0 0.000 0:0.038 false true
16 arthas-NettyWebsocketTtyBootst system 5 RUNNABLE 0.0 0.000 0:0.001 false true
17 arthas-NettyWebsocketTtyBootst system 5 RUNNABLE 0.0 0.000 0:0.001 false true</pre></div>
</div>
</div>
<div class="section" id="thread-all-show-all-matching-threads">
<h3>thread all, show all matching threads<a class="headerlink" href="#thread-all-show-all-matching-threads" title="Permalink to this headline"></a></h3>
<p>Display all matching threads. Sometimes it is necessary to obtain all the thread data of the JVM for analysis.</p>
</div>
<div class="section" id="thread-id-show-the-running-stack-for-the-target-thread">
<h3>thread id, show the running stack for the target thread<a class="headerlink" href="#thread-id-show-the-running-stack-for-the-target-thread" title="Permalink to this headline"></a></h3>
<div class="highlight-shell notranslate"><div class="highlight hljs"><pre class="shell">$ thread 1
&quot;main&quot; Id=1 WAITING on java.util.concurrent.CountDownLatch$Sync@29fafb28
at sun.misc.Unsafe.park(Native Method)
- waiting on java.util.concurrent.CountDownLatch$Sync@29fafb28
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)</pre></div>
</div>
</div>
<div class="section" id="thread-b-locate-the-thread-bocking-the-others">
<h3>thread -b, locate the thread bocking the others<a class="headerlink" href="#thread-b-locate-the-thread-bocking-the-others" title="Permalink to this headline"></a></h3>
<p>In some occasions, we experience the whole application is stuck because theres one particular thread hold one lock that other threads are relying on. To diagnose such an issue, Arthas provides <code class="docutils literal notranslate"><span class="pre">thread</span> <span class="pre">-b</span></code> to find the problematic thread in one single command.</p>
<div class="highlight-bash notranslate"><div class="highlight hljs"><pre class="bash">$ thread -b
&quot;http-bio-8080-exec-4&quot; Id=27 TIMED_WAITING
at java.lang.Thread.sleep(Native Method)
at test.arthas.TestThreadBlocking.doGet(TestThreadBlocking.java:22)
- locked java.lang.Object@725be470 &lt;---- but blocks 4 other threads!
at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at test.filter.TestDurexFilter.doFilter(TestDurexFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at com.taobao.tomcat.valves.ContextLoadFilterValve$FilterChainAdapter.doFilter(ContextLoadFilterValve.java:191)
at com.taobao.eagleeye.EagleEyeFilter.doFilter(EagleEyeFilter.java:81)
at com.taobao.tomcat.valves.ContextLoadFilterValve.invoke(ContextLoadFilterValve.java:150)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:429)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
- locked org.apache.tomcat.util.net.SocketWrapper@7127ee12
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Number of locked synchronizers = 1
- java.util.concurrent.ThreadPoolExecutor$Worker@31a6493e</pre></div>
</div>
<blockquote>
<div><p>Note: By now Arthas only supports to locate the thread blocked by <code class="docutils literal notranslate"><span class="pre">synchronzied</span></code>, while <code class="docutils literal notranslate"><span class="pre">java.util.concurrent.Lock</span></code> is not supported yet.</p>
</div></blockquote>
</div>
<div class="section" id="thread-i-specify-the-sampling-interval">
<h3>thread -i, specify the sampling interval<a class="headerlink" href="#thread-i-specify-the-sampling-interval" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">thread</span> <span class="pre">-i</span> <span class="pre">1000</span></code>: Count the thread cpu time of the last 1000ms.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">thread</span> <span class="pre">-n</span> <span class="pre">3</span> <span class="pre">-i</span> <span class="pre">1000</span></code>: List the 3 busiest thread stacks in 1000ms</p></li>
</ul>
<div class="highlight-bash notranslate"><div class="highlight hljs"><pre class="bash">$ thread -n 3 -i 1000
&quot;as-command-execute-daemon&quot; Id=4759 cpuUsage=23% RUNNABLE
at sun.management.ThreadImpl.dumpThreads0(Native Method)
at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:440)
at com.taobao.arthas.core.command.monitor200.ThreadCommand.processTopBusyThreads(ThreadCommand.java:133)
at com.taobao.arthas.core.command.monitor200.ThreadCommand.process(ThreadCommand.java:79)
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.process(AnnotatedCommandImpl.java:96)
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl.access$100(AnnotatedCommandImpl.java:27)
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:125)
at com.taobao.arthas.core.shell.command.impl.AnnotatedCommandImpl$ProcessHandler.handle(AnnotatedCommandImpl.java:122)
at com.taobao.arthas.core.shell.system.impl.ProcessImpl$CommandProcessTask.run(ProcessImpl.java:332)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:756)
Number of locked synchronizers = 1
- java.util.concurrent.ThreadPoolExecutor$Worker@546aeec1
...</pre></div>
</div>
</div>
<div class="section" id="thread-state-view-the-special-state-theads">
<h3>thread state , view the special state theads<a class="headerlink" href="#thread-state-view-the-special-state-theads" title="Permalink to this headline"></a></h3>
<div class="highlight-bash notranslate"><div class="highlight hljs"><pre class="bash">[arthas@28114]$ thread --state WAITING
Threads Total: 16, NEW: 0, RUNNABLE: 9, BLOCKED: 0, WAITING: 3, TIMED_WAITING: 4, TERMINATED: 0
ID NAME GROUP PRIORITY STATE %CPU DELTA_TIME TIME INTERRUPTE DAEMON
3 Finalizer system 8 WAITING 0.0 0.000 0:0.000 false true
20 arthas-UserStat system 9 WAITING 0.0 0.000 0:0.001 false true
14 arthas-timer system 9 WAITING 0.0 0.000 0:0.000 false true</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="jvm.html" class="btn btn-neutral float-right" title="jvm" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="dashboard.html" class="btn btn-neutral float-left" title="dashboard" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2018-2020, Alibaba Middleware Group, and contributors
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<div class="github-fork-ribbon-wrapper right">
<div class="github-fork-ribbon">
<a href="https://github.com/alibaba/arthas" target="_blank">Fork me at GitHub</a>
</div>
</div>
<script type="text/javascript" src="_static/add_badges.js"></script>
<script src="https://g.alicdn.com/code/lib/highlight.js/9.13.1/highlight.min.js"></script>
<script src="https://g.alicdn.com/code/lib/highlightjs-line-numbers.js/2.5.0/highlightjs-line-numbers.min.js"></script>
<script>
document.querySelectorAll('div.hljs > pre').forEach(function(block) {
hljs.highlightBlock(block);
hljs.lineNumbersBlock(block);
});
</script>
<script type="text/javascript">document.write(unescape("%3Cspan style='display:none;' id='cnzz_stat_icon_1279151497'%3E%3C/span%3E%3Cscript src='https://s4.cnzz.com/z_stat.php%3Fid%3D1279151497' type='text/javascript'%3E%3C/script%3E"));</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?d5c5e25b100f0eb51a4c35c8a86ea9b4";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
</body>
</html>