Any trick to remove a D-state dead process without rebooting?
Hi, fellows: Does anyone know of any hacks that remove a D-state dead process whose parent is pid=1 (actually systemd), without rebooting? Someone posed a trick on the net, but not sure how he did it: https://serverfault.com/questions/76263/how-to-kill-a-defunct-process-with-p... Because the dead process is wrapped as a Systemd unit, I've also asked at Systemd's mailing list without avail: https://lists.freedesktop.org/archives/systemd-devel/2017-December/039941.ht... Appreciate any hint or even dirty hacks! Thanks in advance! Yunchih
On Tue, 05 Dec 2017 09:37:26 +0800, Yun-Chih Chen said:
Does anyone know of any hacks that remove a D-state dead process whose parent is pid=1 (actually systemd), without rebooting?
The problem is that D state means that the process is in the middle of a system call. That means that kernel resources are probably locked and/or there's a deadlock or the syscall is waiting for an event that will never happen. There's no really good safe way of fixing this without rebooting - mostly because trying to patch kernel data structures to "free" the process without knowing exactly *why* it happened is a fool's errand. Things to do to gather data: 1) Check your dmesg/syslog for any WARN, BUG, or OOPS messages with tracebacks, which probably indicates the kernel bug that caused the problem. 2) cat /proc/NNN/stack will give you a hint where the syscall is wedged. After you got those, reboot. The serverfault link is about a different situation - a process that has exited, but no parent process has issued a wait() call to reap its exit status yet. Usually this means that the parent has exited, but for some reason the process hasn't been reparented to PID 1 (which is usually a /sbin/init of sysvinit or systemd flavor) and/or PID 1 has failed to notice the newly reparented process and reaped it.
participants (2)
-
valdis.kletnieks@vt.edu -
Yun-Chih Chen