Troubleshoot Linux process in D state
1 min read

Troubleshoot Linux process in D state

D state means uninterruptible sleep, usually the process is waiting for IO. In this state, the process can not be killed even with kill -9.

Check the state by cat /proc/[pid]/status, there is something like State:  D (disk sleep):

Name:   systemd
Umask:  0000
State:  D (disk sleep)
Tgid:   1
Ngid:   0
Pid:    1
...

Then check /proc/[pid]/wchan to find out where the process is sleeping:

root@GUOJUN-ZJ-86 ~ # cat /proc/1/wchan
cgroup_kn_lock_live

Now we know the process sleep in cgroup_kn_lock_live. For more details, check /proc/[pid]/stack:

root@GUOJUN-ZJ-86 ~ # cat /proc/1/stack
[<0>] cgroup_kn_lock_live+0x42/0xb0
[<0>] cgroup_mkdir+0x35/0x1d0
[<0>] kernfs_iop_mkdir+0x51/0x80
[<0>] vfs_mkdir+0x10e/0x1c0
[<0>] do_mkdirat+0xd1/0xf0
[<0>] __x64_sys_mkdir+0x16/0x20
[<0>] do_syscall_64+0x55/0x1b0
[<0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[<0>] 0xffffffffffffffff

TBD...