jstack,jstack用于tomcat进程

jstack命令用于tomcat进程时会出现以下错误:
Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Method)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:34)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(LinuxDebuggerLocal.java:431)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:109)
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(LinuxDebuggerLocal.java:134)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebuggerLocal.java:437)
at sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:48)
at sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess.getCurrentFrameGuess(LinuxX86JavaThreadPDAccess.java:75)
at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:252)
at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:211)
at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:50)
at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)
网上关于这种问题的信息较少,但是还是有点,先保存点,再做尝试。
Very likley due to too much memory usage causing GC. Add the params to java:
-verbosegc -XX:+PrintGCDetails
And see if you notice anything obvious in the output/logs
Do you get the same result with a kill -3 <pid>?
For Tomcat, I was able to use "kill -3 <tomcat_pid>" as a workaround. I got basically the same behavior with OpenJDK on Ubuntu 10.10 x86_64.
Changed in sun-java6 (Ubuntu):
status: Invalid → New
You must invoke jstack as the user who started/is running the given process.
The above error occurs if you invoke jstack as "root"/via sudo (Has Super Cow Powers but is still the wrong user)
I guess you tried the "-F" option, because it didn't work without it. Therefore, you tried the sledgehammer :). "-F" IS for a hung process.
If you want to create a thread dump of e.g. tomcat6 (installed from ubuntu package repo) you must type the following:
"sudo -u tomcat6 jstack 8812"
Executes jstack as user tomcat6, who is running the service tomcat6, assuming tomcat's pid is 8812.
This is not an ubuntu bug, it's - say - some sort of usability issue with this jstack thing. Blame Sun/Oracle . . .
Tags:  tomcat下载 tomcat tomcat进程 jstack

延伸阅读

最新评论

发表评论