English 中文(简体)
如何获得一个正在运行的 百分之百的cpu的 java 程序的全部线索?
原标题:How to get a complete stack trace of a running java program that is taking 100% cpu?

我确实有个Jenkins的例子 被困在无尽的循环中 没有任何可见的活动

我能得到运行过程的 pid , 因此我如何生成一个可以用于错误报告的跟踪?

我跑在林克斯上。

最佳回答

尝试 < a href=>" "http://download.oracle.com/javase/ 1.5.0/docs/tooldocs/share/jstack.html" rel = "noreferr" >jstack 。 它会给你一份完整的列表, 列出你的线条正在做什么。 它只需要进程 Pid 。

问题回答

使用线索倾弃。 通过 VM 连接并请求倾弃。 或者如果在 unix 上, kill -3pid 或进程控制台上的窗口Ctrl+Break 将会为您做到这一点。 倾弃将直接进入控制台。 您也可以使用 jstack 来丢弃一个倾弃 。

Ctrl/code> on linux (发送 SIGQUIT )

Ctrl+Break on window(在 MSVCRT 下发送 SIGBRIEAK )

在 *nix 中,通过按下 H < /code>, top 您可以看到线条。

然后,在 jps 中,你可以看到 pid ,同时铭记,如果进程是以特权启动的,那么你就必须使用 sudo 执行,例如 sudo

如果您将线索 ID 转换为十六进制, 那么您就可以将数据与 jstack pid 输出交叉 。

两种工具均在$JAVA_HOME/bin中。

看看""http://visualvm.java.net/" rel="no follow" >VivialVM 。它有许多很好的特征分析工具,你可以做一个线状垃圾堆。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...