Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there some cases in which SIGKILL will not work?

Are there any cases where an application running on Linux, which has not blocked signal SIGKILL, will not get killed on firing SIGKILL signal?

like image 656
Mandar Avatar asked Dec 22 '11 07:12

Mandar


People also ask

Can a process ignore SIGKILL?

When a process receives SIGKILL it is terminated. This is a special signal as it can't be ignored and we can't change its behavior. We use this signal to forcefully terminate the process.

Can SIGKILL be blocked?

Signals that cannot be ignored (SIGKILL and SIGSTOP) cannot be blocked. Signals can cause the interruption of a system call in progress, leaving it to the application to manage a non-transparent restart.

Can SIGKILL be trapped?

The trap in the example above executes the cleanup function when it detects one of the four signals: SIGHUP , SIGINT , SIGQUIT , or SIGABRT . The signals are referred to by their number. Note: The SIGKILL signal cannot be trapped. It always immediately interrupts the script.

Can SIGSTOP be blocked?

The signals SIGKILL or SIGStop cannot be blocked. Any attempt to use sigprocmask() to block these signals is simply ignored, and no error is returned.


3 Answers

SIGKILL cannot be blocked or ignored (SIGSTOP can't either).

A process can become unresponsive to the signal if it is blocked "inside" a system call (waiting on I/O is one example - waiting on I/O on a failed NFS filesystem that is hard-mounted without the intr option for example).

(Another side case is zombie processes, but they're not really processes at that point.)

like image 153
Mat Avatar answered Sep 30 '22 18:09

Mat


Yes, when the process is blocked in kernel space, e.g. reading on a blocked NFS file system, or on a device which does not respond.

like image 38
Basile Starynkevitch Avatar answered Sep 30 '22 19:09

Basile Starynkevitch


Check with ps a (or you can use other flags as well) the process state. If a process state is

D : uninterruptible sleep (usually IO)

then you cannot kill that process.
As others mentioned, and as it is defined, this is usually caused by a stuck I/O, for example process waiting to do I/O to a disconnected NFS file system.

like image 37
mazs Avatar answered Sep 30 '22 19:09

mazs