E.g. does the bash debugger support attaching to existing processes and examining the current state?
Or can I easily find out by looking at the bash process entries in /
Use pstree
to show what linux command/executable your script is calling. For example, 21156
is the pid of my hanging script:
ocfs2cts1:~ # pstree -pl 21156
activate_discon(21156)───mpirun(15146)─┬─fillup_contig_b(15149)───sudo(15231)───chmod(15232)
├─ssh(15148)
└─{mpirun}(15147)
So that, I know it's hanging at chmod
command. Then, show the stack trace by:
ocfs2cts1:~ # cat /proc/15232/stack
[] __ocfs2_cluster_lock.isra.39+0x1bf/0x620 [ocfs2]
[] ocfs2_inode_lock_full_nested+0x12d/0x840 [ocfs2]
[] ocfs2_inode_lock_atime+0xcb/0x170 [ocfs2]
[] ocfs2_readdir+0x41/0x1b0 [ocfs2]
[] iterate_dir+0x9c/0x110
[] SyS_getdents+0x83/0xf0
[] entry_SYSCALL_64_fastpath+0x12/0x6d
[] 0xffffffffffffffff
Oh, boy, it's likely a deadlock bug...