This chapter provides information and guidance on some specific procedures for troubleshooting hanging or looping processes.
Problems can occur that involve hanging or looping processes. A hang can occur for many reasons but often stems from a deadlock in application code, API code, or library code. A hang can even be due to a bug in the Java HotSpot VM.
Sometimes an apparent hang turns out to be, in fact, a loop. For example, a bug in a VM process that causes one or more threads to go into an infinite loop can consume all available CPU cycles.
The initial step when diagnosing a hang is to find out if the VM process is idle or consuming all available CPU cycles. You can do this using a native operating system (OS) utility. If the process appears to be busy and is consuming all available CPU cycles then it is likely that the issue is a looping thread rather than a deadlock. On Oracle Solaris operating system, for example, the command prstat -L -p
pid can be used to report the statistics for all lightweight processes (LWPs) in the target process and thus will identify the threads that are consuming a lot of CPU cycles.
This chapter contains the following sections: