pstack Command

The pstack command displays a stack trace for each process. The pstack command must be run by the owner of the process or by root. You can use the pstack command to determine where a process is hung. The only argument that needs to be provided is the ID of the process that you want to check or the name of a core file. For more information about the pstack command, see the proc(1) man page.

Example 6-2 Displaying Stack Trace for NFS Process

# /usr/bin/pgrep nfsd
243
# /usr/bin/pstack 243
243:    /usr/lib/nfs/nfsd -a 16
 ef675c04 poll     (24d50, 2, ffffffff)
 000115dc ???????? (24000, 132c4, 276d8, 1329c, 276d8, 0)
 00011390 main     (3, efffff14, 0, 0, ffffffff, 400) + 3c8
 00010fb0 _start   (0, 0, 0, 0, 0, 0) + 5c

The example shows that the process is waiting for a new connection request, which is a normal response. If the stack shows that the process is still in poll after a request is made, the process might be hung. For more information about fixing a hung process, see How to Restart NFS Service. For more information about troubleshooting NFS, see NFS Troubleshooting Procedures.