无法获取线程转储?任何想法为什么我的应用程序阻塞?

Unable to get thread dump? Any ideas why my app blocks?(无法获取线程转储?任何想法为什么我的应用程序阻塞?)

本文介绍了无法获取线程转储?任何想法为什么我的应用程序阻塞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基本的 java 服务器应用程序,它有 100 个工作线程,它们在 url 上执行简单的 HEAD 请求.我为此使用 HttpClient 4.x.

I have a basic java server app that has 100 worker threads that do simple HEAD requests on urls. I'm using HttpClient 4.x for this.

运行几分钟后,我的程序就冻结了几分钟,我不知道为什么.查看视觉 vm 监视器报告的屏幕截图.你可以看到它是平的.在此期间,我无法获得良好的线程转储,并且视觉虚拟机只是冻结,直到它被解除阻塞.有没有人知道我可以做些什么来尝试开始调试这个家伙?

A few minutes into the run my program just freezes for a couple minutes and I cannot figure out why. Check out the screen shot of what visual vm monitor reports. You can see it flatline. During this time I'm unable to get a good thread dump and visual vm just freezes until it's unblocked. Does anyone have any ideas on what I can do to try and start debugging this guy?

视觉虚拟机:http://tinypic.com/view.php?pic=2i915bs&s=7

这是我在冻结时尝试获取 jstack 转储时的输出:

Here is the output when I tried to take a jstack dump while it was frozen:

jstack -F 4325 
Attaching to process ID 4325, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 16.3-b01
Deadlock Detection:

No deadlocks found.

Thread 4557: (state = BLOCKED)
Error occurred during stack walking:
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:152)
    at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebuggerLocal.java:466)
    at sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:65)
    at sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess.getCurrentFrameGuess(LinuxAMD64JavaThreadPDAccess.java:92)
    at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:256)
    at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:218)
    at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:76)
    at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:45)
    at sun.jvm.hotspot.tools.JStack.run(JStack.java:60)
    at sun.jvm.hotspot.tools.Tool.start(Tool.java:221)
    at sun.jvm.hotspot.tools.JStack.main(JStack.java:86)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at sun.tools.jstack.JStack.runJStackTool(JStack.java:118)
    at sun.tools.jstack.JStack.main(JStack.java:84)
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:51)
    at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(LinuxDebuggerLocal.java:460)
    at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(LinuxDebuggerLocal.java:127)

推荐答案

我在 Linux 上看到了几个关于 jstack 的错误报告,并有类似的跟踪:

I've seen several bug reports about jstack on Linux with a similar trace:

  • JVM 错误 ID:6494722(应该是固定的)
  • Ubuntu Bug #597098(这个不是)
  • JVM Bug Id: 6494722 (is supposed to be fixed)
  • Ubuntu Bug #597098 (this one is not)

kill -3 <pid> 是否得到相同的结果?

Do you get the same result with a kill -3 <pid>?

这篇关于无法获取线程转储?任何想法为什么我的应用程序阻塞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:无法获取线程转储?任何想法为什么我的应用程序阻塞?

基础教程推荐