See Where a Sleeping Process Is Stuck with /proc wchan
Read /proc/PID/wchan to see the kernel function a sleeping process is waiting in. A sleep command showed hrtimer_nanosleep; many hardened kernels show 0.
A process is not using any CPU and not finishing, and you want a hint about what it waits for.
sleep 30 &
pid=$!
sleep 0.5
echo "wchan: $(cat /proc/$pid/wchan)"
cat /proc/$pid/stat | cut -d' ' -f1-3
grep -E '^(State|Name)' /proc/$pid/status
cat /proc/sys/kernel/kptr_restrict
kill $pidwchan: hrtimer_nanosleep
2722 (sleep) S
Name: sleep
State: S (sleeping)
0The file /proc/PID/wchan names the kernel function in which the process is blocked. A sleep command printed hrtimer_nanosleep, which is the timer wait behind nanosleep. Together with the state in /proc/PID/status, here S (sleeping), it separates a process waiting on a timer from one waiting on a pipe, a lock or a disk. A state of D means an uninterruptible wait, usually for storage. See proc_pid_wchan.
The kernel may print 0 instead of a name when symbol lookup is restricted, as it can with a non-zero kptr_restrict or a build without symbols; the value here was 0 and the names were visible. The wchan is only the innermost function, so for the whole chain read /proc/PID/stack as root.