jstack命令(Java Stack Trace)
jstack用于打印出给定的java进程ID或core file或远程调试服务的Java堆栈信息,如果是在64位机器上,需要指定选项"-J-d64",Windows的jstack使用方式只支持以下的这种方式。
例如说,通过:
ps ax | grep java
找到java的进程ID
jstack
堆栈信息:
-- :: Full thread dump Java HotSpot(TM) -Bit Server VM (24.71-b01 mixed mode): tid=0x00007fbce48bb000 nid=0x330b waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None tid=0x00007fbce528e800 nid=0x5903 waiting on condition [0x0000000118d05000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007d7610080> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.) at kafka.consumer.ZookeeperConsumerConnector$ZKRebalancerListener$$anon$.run(ZookeeperConsumerConnector.scala:) Locked ownable synchronizers: - None tid=0x00007fbce52ea000 nid=0x5703 waiting on condition [0x0000000118c02000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007d7600440> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:) at java.lang.Thread.run(Thread.java:) Locked ownable synchronizers: - None tid=0x00007fbce52e4800 nid=0x5503 waiting on condition [0x0000000118aff000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007d7608408> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:) at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:) Locked ownable synchronizers: - None tid=0x00007fbce536e000 nid=0x5303 runnable [0x00000001189fc000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.KQueueArrayWrapper.kevent0(Native Method) at sun.nio.ch.KQueueArrayWrapper.poll(KQueueArrayWrapper.java:) at sun.nio.ch.KQueueSelectorImpl.doSelect(KQueueSelectorImpl.java:) at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:) - locked <) - locked <0x00000007d76101e0> (a java.util.Collections$UnmodifiableSet) - locked <0x00000007d7610180> (a sun.nio.ch.KQueueSelectorImpl) at sun.nio.ch.SelectorImpl.) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:) Locked ownable synchronizers: - None tid=0x00007fbce52e3800 nid=0x5207 waiting on condition [0x00000001188f9000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007d7608500> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:) at org.I0Itec.zkclient.ZkEventThread.run(ZkEventThread.java:) Locked ownable synchronizers: - None tid=0x00007fbce5373000 nid=0x4b03 waiting on condition [0x00000001187f1000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007d76085f0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:) at java.lang.Thread.run(Thread.java:) Locked ownable synchronizers: - None tid=0x00007fbce539a000 nid=0x4903 waiting on condition [0x00000001186ee000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007d76085f0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:) at java.lang.Thread.run(Thread.java:) Locked ownable synchronizers: - None tid=0x00007fbce4022800 nid=0x4503 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None tid=0x00007fbce4021800 nid=0x4303 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None tid=0x00007fbce503b000 nid=0x4103 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None tid=0x00007fbce5035000 nid=0x3413 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None tid=0x00007fbce5032800 nid=0x2d03 in Object.wait() [0x0000000116146000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000007d7618ca0> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.) - locked <0x00000007d7618ca0> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.) at java.lang.) Locked ownable synchronizers: - None tid=0x00007fbce5031800 nid=0x2b03 in Object.wait() [0x0000000116043000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00000007d76189c8> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:) at java.lang.) - locked <0x00000007d76189c8> (a java.lang.ref.Reference$Lock) Locked ownable synchronizers: - None tid=0x00007fbce5801000 nid=0x1303 waiting on condition [0x000000010c900000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000007d760c9e8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:) at kafka.consumer.ConsumerIterator.makeNext(ConsumerIterator.scala:) at kafka.consumer.ConsumerIterator.makeNext(ConsumerIterator.scala:) at kafka.utils.IteratorTemplate.maybeComputeNext(IteratorTemplate.scala:) at kafka.utils.IteratorTemplate.hasNext(IteratorTemplate.scala:) at KafkaConsumer.consume(KafkaConsumer.java:) at KafkaConsumer.main(KafkaConsumer.java:) Locked ownable synchronizers: - None tid=0x00007fbce502f000 nid=0x2903 runnable tid=0x00007fbce5001800 nid=0x2103 runnable tid=0x00007fbce5002000 nid=0x2303 runnable tid=0x00007fbce5002800 nid=0x2503 runnable tid=0x00007fbce4806000 nid=0x2703 runnable tid=0x00007fbce401e800 nid=0x4703 waiting on condition JNI
相关说明:
1.命令格式
jstack [ option ] pid
jstack [ option ] executable core
jstack [ option ] [server-id@]remote-hostname-or-IP
2、常用参数说明
1)options:
executable Java executable from which the core dump was produced.
(可能是产生core dump的java可执行程序)
core 将被打印信息的core dump文件
remote-hostname-or-IP 远程debug服务的主机名或ip
server-id 唯一id,假如一台主机上多个远程debug服务
2)基本参数:
-F当’jstack [-l] pid’没有相应的时候强制打印栈信息
-l长列表. 打印关于锁的附加信息,例如属于java.util.concurrent的ownable synchronizers列表.
-m打印java和native c/c++框架的所有栈信息.
-h | -help打印帮助信息
pid 需要被打印配置信息的java进程id,可以用jps查询.
有篇分析的文章写得特别的好,忍不住分享了:
http://jameswxx.iteye.com/blog/1041173
jstack命令(Java Stack Trace)的更多相关文章
- JDK内置工具jstack(Java Stack Trace)(转)
1.介绍 jstack用于打印出给定的java进程ID或core file或远程调试服务的Java堆栈信息,如果是在64位机器上,需要指定选项"-J-d64",Windows的js ...
- 三、jdk工具之jstack(Java Stack Trace)
目录 一.jdk工具之jps(JVM Process Status Tools)命令使用 二.jdk命令之javah命令(C Header and Stub File Generator) 三.jdk ...
- jmap命令(Java Memory Map)(转)
JDK内置工具使用 一.javah命令(C Header and Stub File Generator) 二.jps命令(Java Virtual Machine Process Status To ...
- 给你的Java程序拍个片子吧:jstack命令解析
前言 如果有一天,你的Java程序长时间停顿,也许是它病了,需要用jstack拍个片子分析分析,才能诊断具体什么病症,是死锁综合征,还是死循环等其他病症,本文我们一起来学习jstack命令~ jsta ...
- 十一、jdk命令之Jstatd命令(Java Statistics Monitoring Daemon)
目录 一.jdk工具之jps(JVM Process Status Tools)命令使用 二.jdk命令之javah命令(C Header and Stub File Generator) 三.jdk ...
- 十一、jdk命令之Jstatd命令(Java Statistics Monitoring Daemon)远程的监控工具连接到本地的JVM执行命令
目录 一.jdk工具之jps(JVM Process Status Tools)命令使用 二.jdk命令之javah命令(C Header and Stub File Generator) 三.jdk ...
- Java 抓取 thread dump (Full Thread Stack Trace) 方法汇总
顾名思义,表示一个时间点上,显示进程里面每一个线程的 stack trace,以及线程之间关联,比如等待 常用来定位一些 不响应,CPU 很高,内存使用很高问题 汇总表格如下 工具 操作系统 Java ...
- Java的jstack命令使用详解
jstack命令简介 jstack(Java Virtual Machine Stack Trace)是JDK提供的一个可以生成Java虚拟机当前时刻的线程快照信息的命令行工具.线程快照一般被称为th ...
- java jstack命令详解
名称jstack: stack trace 摘要: jstack [ option ] pid jstack [ option ] executable core jstack [ option ] ...
随机推荐
- 初学JDBC,JDBC工具类的简单封装
//工具类不需要被继承 public final class JdbcUtils{ //封装数据库连接参数,便于后期更改参数值 private static String url="jdbc ...
- TFS2008解除独占式锁定文件命令(转载)
使用场景:如果项目团队成员A对项目某个文件以独占式方式签出,恰好那天该成员A没有来上班而成员需要对此文件进入修改并check in,这时需要先把A对该文件的锁定解除.没有IDE可以使用,只能使用下面的 ...
- C# ManualResetEvent 的方法介绍
名称 说明 1. Close 在派生类中被重写时,释放由当前 WaitHandle 持有的所有资源. (继承自 WaitHandle.)在XNA Framework中,此成员由 Close() ...
- 转:Java NIO系列教程(二) Channel
Java NIO的通道类似流,但又有些不同: 既可以从通道中读取数据,又可以写数据到通道.但流的读写通常是单向的. 通道可以异步地读写. 通道中的数据总是要先读到一个Buffer,或者总是要从一个Bu ...
- ubuntu.sh: 113: ubuntu.sh: Syntax error: "(" unexpected
在ubuntu电脑上安装lnmp环境,执行下面命令时 sudo sh ubuntu.sh 报错误:ubuntu.sh: 113: ubuntu.sh: Syntax error: "(&qu ...
- 移动端富文本编辑器artEditor
摘要: 由于手机上打字比较慢,并不适合长篇大论的文章,所以移动端的富文本编辑器很少.artEditor是一款基于jQuery的移动端富文本编辑器,支持插入图片,后续完善其他功能. 插件地址:https ...
- POJ 1054 The Troublesome Frog
The Troublesome Frog Time Limit: 5000MS Memory Limit: 100000K Total Submissions: 9581 Accepted: 2883 ...
- zhx's contest (矩阵快速幂 + 数学推论)
zhx's contest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To ...
- Goldbach's Conjecture
Goldbach's Conjecture Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I ...
- Model backing a DB Context has changed; Consider Code First Migrations
Model增加一个字段,数据库对应的也手动添加了字段但是运行时报错 The model backing the 'TopLogDbContext' context has changed since ...