2

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?

nutty about natty
  • 6,658
  • 8
  • 47
  • 68
  • [...voodoo programming](http://www.catb.org/jargon/html/V/voodoo-programming.html) – Rmano Sep 21 '15 at 14:24
  • 2
    Or run `killall -9` ... *once*. – muru Sep 21 '15 at 14:42
  • 1
    That example should not need 2 killalls. Chrome probably will start a clean up process (clearing cache etc.) that will take a bit of time. The 2nd one probably "works" because the 1st one actually ended. – Rinzwind Sep 21 '15 at 21:44
  • @Rinzwind does the 2nd one possibly "override" the *grace period* (which I found [loosely being referred to in a number of other posts](http://stackoverflow.com/questions/21856624/using-appropriate-posix-signals))? Is there a way/flag to verbosely monitor the *grace period* "count-down"? Is there some hard evidence / source code to confirm the "override" hypothesis? – nutty about natty Sep 22 '15 at 05:08
  • The override is the "-9" as muru stated. – Rinzwind Sep 22 '15 at 06:34
  • @Rinzwind the "-9" override is *not* the same as the double "-15" override (even if the eventual outcome is equivalent) -- plz prove me wrong. – nutty about natty Sep 22 '15 at 07:42

1 Answers1

2

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.

heemayl
  • 90,425
  • 20
  • 200
  • 267