Ubuntu – Does killall (sometimes?) needs to be applied twice

command linekillkillallprocess

Why does killall (sometimes?) need to be applied twice? Here's an example where a "double" killall is needed to end the process.

When and why does a process needed to be killed "twice"? What happens under the bonnet?

Best Answer

I am going to state a application-specific possibility.

When you use killall program, a SIGTERM (signal 15) is sent to the program. The usual response to SIGTERM is that the program would exit gracefully.

Now as the SIGTERM is catchable, a program can have a signal handler for SIGTERM that would do some task upon receiving the first SIGTERM (first killall) and return to a state where the second SIGTERM would just terminate it (default action). This is highly dependent on the developer of the program of course and not a general case.