2

I have a piece of Java code that sometimes causes the JVM to "hang". When this happens, I can't communicate with it through tools like jvisualvm (the tool will say "connection timed out"), and it will also not print a thread dump or terminate when I issue a SIGQUIT (kill -3). The process will terminate if I issue a SIGABRT (kill -6).

Therefore, I can't get a thread dump nor find out what's in its memory. How can one get more information in this situation? If it helps, the OS is OSX and my JVM version is
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509) Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

4

1 回答 1

1

你不能,这就是为什么它被称为“挂起”。由于内部问题(例如无限循环、死锁...),JVM 进程没有响应,因此它不会响应。这可能是由于 JVM 实现中的错误造成的。您可以尝试调试 JVM 以了解发生了什么。HotSpot 是 GPL,因此您也可以获取源代码。

如果您怀疑代码中的某些东西导致了这种挂起(例如,当您执行特定操作时,JVM 总是挂起),您可以粘贴它以便我们查看。

于 2013-07-23T17:42:55.257 回答