How to get a complete stack trace of a running jav

2020-02-01 03:34发布

I do have a jenkins instance that is stuck in some kind of endless loop without any visible activity.

I can get the pid of the running process so how do I generate a trace that I can use for a bug report?

I'm running on linux.

5条回答
成全新的幸福
2楼-- · 2020-02-01 03:40

Take a look at VisualVM. There is a lot of nice profiling tools with it, and you can perform a thread dump.

查看更多
够拽才男人
3楼-- · 2020-02-01 03:53

Take a thread dump. Connect through Visual VM and request a dump. Or if on unix then kill -3 pid or on windows Ctrl+Break on the process console would do it for you. The dump goes straight to the console. You can also use jstack to throw a dump.

查看更多
祖国的老花朵
4楼-- · 2020-02-01 03:59

In *nix, with top by pressing H you can see the threads.

Then with jps you can see the pid bear in mind that if the process was started with privileges then you must execute it with sudo for instance.

If you take the thread id and converted it to hexadecimal then you can cross that data with the jstack pid output.

Both tools are in $JAVA_HOME/bin.

查看更多
叛逆
5楼-- · 2020-02-01 04:02

Ctrl+\ on linux (which sends SIGQUIT)

Ctrl+Break on windows (which sends SIGBREAK under MSVCRT)

查看更多
啃猪蹄的小仙女
6楼-- · 2020-02-01 04:04

Try with jstack. It'll give you a full list of what your threads are doing. All it needs is the process pid.

查看更多
登录 后发表回答