How to gather java debuging on Linux

  • 7008658
  • 27-May-2011
  • 09-Aug-2012

Environment

Novell Identity Manager 3.5.1
Novell Identity Manager 3.6.1
Novell Identity Manager 4.0

Situation

In troubleshooting some drivers it is useful to gather Java debugging information.

Resolution

To get a Thread dump from jdb:
 
1) Open DriverSet properties from iManager & navigate to the misc tab.
2) provide a port number in the java debug port (say 10000)
3) restart ndsd
4) go to jdk_home/bin (you need to have a jdk for Java 1.6.06 or later patch installed in the local box)
5) run the following to start the jdb
./jdb -attach <debug_port>
6) at the jdb prompt enter the following commands in order
suspend
where all
resume
7) enter "quit" to exit. capture the thread dump.


It is possible to use the Linux command script to save the thread dump to a file. It can also be helpful to capture the stack several times, a few minutes apart, so that we can see if the system is completely hang or if it is in a loop/deadlock/other condition.

Between steps 4 and 5 we can just type:
script threads.txt
to start saving the command line text, and after repeating steps 5 through 7 a few times, at least one minute apart, just type 'exit' to leave scripts while saving the terminal content to the file 'threads.txt'.