You are not logged in.
Pages: 1
Topic closed
Hi
Say you have a process that blocks access to a device e.g. a v4l2 device.
Say also that this process is a zombie and is defunct. Therefore kill -9 will not work on the process no matter how often you try.
What can you do to access the device again (better: to kill the process) without rebooting the system?
Last edited by Cdh (2010-05-25 23:52:18)
฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz
Offline
Afaik, there's nothing you can do except to try and kill the parent process. And in case the parent process is init (PID 1), nothing but a reboot will fix that.
Offline
That sucks.
I mean, with root there should be a switch kill -9 --force --i-really-want-to-no-matter-what-consequences
The same with modules that don't work anymore but still block access to the hardware while rmmod -f doesn't work.
chris@chrispc ~ % kill -9 5403
chris@chrispc ~ % ps -x | grep 5403
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
5403 ? Ds 0:03 guvcview
6507 pts/0 S+ 0:00 grep --color=auto 5403
chris@chrispc ~ % lsof | grep /dev/video0
guvcview 5403 chris mem CHR 81,0 5300 /dev/video0
guvcview 5403 chris 6r CHR 81,0 0t0 5300 /dev/video0
chris@chrispc ~ %FFFFUUU
฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz
Offline
That is not a defunct process - those are marked with a 'Z' instead of 'D'. This one is stuck waiting for something. If it ever wakes up at all, strace might be useful, but this is more like a kernel-level sleep, as if /dev/video0 is wedged.
Offline
Was mistaken and edited the title, thanks.
The problem is still the same. I know that whatever the process is waiting for is not going to happen...
I cannot believe there is no mechanism to force-kill these things... This happens to me not really often but yet often enaugh that I miss this functionality.
Another example was when I was trying disabling of one CPU core with echo 0 > /sys/devices/system/cpu/cpu1/online
root 74570.0 0.2 5792 2488 ? D 10:58 0:00 zsh
root 76920.0 0.2 5808 2484 pts/1 D+ 11:02 0:00 -zsh
root 77580.0 0.2 5808 2492 ? D 11:03 0:00 -zsh
root 78240.0 1.2 38108 12492 ? D 11:04 0:00 gnome-system-monitor
chris 78820.01.2 63904 12848 ? D 11:05 0:00 gnome-system-monitor
root 81000.0 0.0 1668 448 pts/5 D+ 11:07 0:00 rmmod powernow_k8Yea, maybe it doesn't work with my CPU but that is no reason to block all the processes and give me no control to kill them...
฿ 18PRsqbZCrwPUrVnJe1BZvza7bwSDbpxZz
Offline
Was mistaken and edited the title, thanks.
The problem is still the same. I know that whatever the process is waiting for is not going to happen...
I cannot believe there is no mechanism to force-kill these things... This happens to me not really often but yet often enaugh that I miss this functionality.
There isn't such a mechanism (kill -9 --force --i-really-want-to-no-matter-what-consequences) because you really actually don't want to kill a process in state D. Such processes are in uninterruptible kernel sleep, and are designed to stay there for very short amounts of time, although in practice, bad hardware / kernel bugs / gigantic writes can keep it there for a long time. They are in this state in order for the kernel to be able to ensure well-defined concurrency behaviour, and thus giving even root the ability to kill them would allow the user to invoke undefined behaviour in the kernel, which could lead to memory or filesystem corruption, and other bad things.
There is built-in kernel functionality (khungtaskd) which kills these processes eventually.
(EDIT: not being a kernel programmer myself, this is just my interpretation of the docs, and of the fact that if it were safe to kill these processes yourself, Linux would probably let you.)
Last edited by tavianator (2010-05-26 00:50:52)
Offline
Old thread. but now zps is your friend.
zps -l -- list the zombie process
zps -x -- nuke all zombie process from orbit. It's the only way to be sure.
Offline
riiiight now zombie
is my only friend..
(I’ll reap all you sow)
Offline
Closing this old thread.
Offline
Pages: 1
Topic closed