介紹
jstack用來檢視Java程序的堆棧資訊
常用參數
首先檢視oracle官網的介紹
pid不做詳細介紹
executable
描述:Java executable from which the core dump was produced.
中文意思:Java程式核心dump生成
core
描述:core file for which the stack trace is to be printed.
中文意思:列印堆棧跟蹤的核心檔案
remote-hostname-or-IP不做詳細介紹
server-id不做詳細介紹
需要特别注意的是在官方描述中有這樣一句話: If the given process is running on a 64-bit VM, you may need to specify the -J-d64 option.意思就是如果程式運作在64位虛拟機上需要添加-J-d64
例:jstack -J-d64 -m pid
Options介紹:
-F
描述:to force a thread dump. Use when jstack does not respond (process is hung)
個人了解:當使用jstack 沒有相應資訊的時候強制列印線程棧資訊
-l
描述:Long listing. Prints additional information about locks such as list of owned java.util.concurrent ownable synchronizers.
個人了解:列印關于鎖的額外資訊java.util.concurrent的ownable synchronizers清單
-m
描述:prints mixed mode (both Java and native C/C++ frames) stack trace.
個人了解:列印混合模式(Java和本地C/C++架構)堆棧資訊
個人使用總結:
使用jstack -F -l 檢視是否提示有死鎖
如果出現死鎖再根據dump資訊做進一步分析。