Process execution tracing tools

筅森魡賤 提交于 2019-12-04 16:14:56

ltrace traces shared-library function calls. That can give you a higher-level view of things. But it can also spew tons more output than strace, since many library functions (e.g. strcmp) don't result in system calls.

But futex is used for locking, so if you get stuck at futex, you probably deadlocked. Or you're just looking at one thread which is waiting for other threads. ltrace/strace -f follows clone/fork to trace all threads/all child processes.

In gdb, sometimes thread apply all <command> is useful for multithreaded processes. e.g. thread apply all bt

Do you have source code for the Java program? If so, you can remotely debug it using Eclipse or another IDE. If you don't have source code, your options are more limited, but you can try connecting to the process via JConsole to gain some insight into what's happening. Java profiling tools are another option, but harder to set up.

Maybe jvisualvm, which comes with the java from Sun, has what you need. You can record the state of the virtual machine as your program is running and also tell it to save any stack dumps to a file you can later open and look at. Look for jvisualvm in the bin directory of your jdk. Here's where you can see more documentation: http://java.sun.com/javase/6/docs/technotes/tools/share/jvisualvm.html

Good luck!

Use gdb to attach to the process. gdb isn't exactly intuitive, but there are a lot of howtos and similar on the net.

http://dirac.org/linux/gdb/06-Debugging_A_Running_Process.php

See this solution I have found.

In this case the hangs were caused by slow generation of random bytes from /dev/random.

The Java application waits for very long time to get random bytes.

This is not really a solution, but rather a workarround since the /dev/random will become the same as /dev/urandom.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!