Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process permanently stuck on D state [closed]

I have an issue with some processes stuck in a D state on Ubuntu 10.04.3 LTS.

They have been in this state since Nov the 5th (today being December 6th). I understand these are uninterruptible sleep states often related to waiting for data from hardware such as a hard disk. This is a production server so rebooting is a very last resort, is anyone able to shed any light on what these processes might be?

This is the output for the D state items from ps -aux

www-data 22851  0.0  0.0      0     0 ?        D    Nov05   0:00 [2637.64] www-data 26306  0.0  0.0   4008    12 ?        D    Nov05   0:00 ./2.6.37 www-data 26373  0.0  0.0   4008    12 ?        D    Nov05   0:00 ./n2 www-data 26378  0.0  0.0   4008    12 ?        D    Nov05   0:00 ./n2 

This is output of ps axl | awk '$10 ~ /D/' for a little more info.

0    33 22851     1  20   0      0     0 econet D    ?          0:00 [2637.64] 1    33 26306     1  20   0   4008    12 ec_dev D    ?          0:00 ./2.6.37 1    33 26373     1  20   0   4008    12 ec_dev D    ?          0:00 ./n2 1    33 26378     1  20   0   4008    12 ec_dev D    ?          0:00 ./n2 

Is there a way to kill these? Does having processes in this state when rebooting cause any issues?

like image 729
Dr Craig Avatar asked Dec 06 '13 12:12

Dr Craig


People also ask

How do I check my process in D state?

Resolution. Processes in a "D" or uninterruptible sleep state are usually waiting on I/O. The ps command shows a "D" on processes in an uninterruptible sleep state. The vmstat command also shows the current processes that are "blocked" or waiting on I/O.

What is D state Linux?

State "D" (uninterruptible sleep) means that the process is in kernel space (in a system call), attempting to perform IO. These processes will not respond to signals (or SIGKILL) and cannot be debugged with gdb or pstack.

What causes uninterruptible sleep?

One of the curious features of Unix systems (including Linux) is the "uninterruptible sleep" state. This is a state that a process can enter when doing certain system calls. In this state, the process is blocked performing a sytem call, and the process cannot be interrupted (or killed) until the system call completes.

How do I see sleep processes in Linux?

Show activity on this post. Just grep -l sleeping /proc/[0-9]*/status and maybe pipe it via | xargs -n1 dirname | xargs -n1 basename or something like that. Looping and checking return value and echo will be very slow. Using { } instead of do done is discouraged - it's a (strange) bash extension, just do done .


1 Answers

This is the dreaded un-interruptible (TASK_UNINTERRUPTIBLE) state of a process. This is the state where the process doesn't react to signals until what it started to wait for, gets done. Unfortunately it is a necessary evil. See here and here What is an uninterruptable process?.

My answer is to reboot the system.
Do rebooting cause any issues ?
Hard to tell, it may it may not. The process which is in the D state may have to do some crucial updates which it wont if you reboot.
If you really cant afford to reboot, try to find the disk on which the process is waiting and see if the disk is working fine by opening, closing, reading/writing into it

like image 114
Deepthought Avatar answered Sep 22 '22 19:09

Deepthought