Adverse consequences of using kill -9 for Skype termination

0

I currently shut Skype down by using ps ax | grep skype and then issuing kill -9 on the PIDs. There are three PIDs to be killed.

What are the adverse consequences for Ubuntu that result from killing Skype this way? I am concerned about resources not being freed or garbage files being left in various places.

H2ONaCl

Posted 2011-11-07T14:31:43.577

Reputation: 1 157

Answers

1

You're right to be concerned.

Unix/Linux programs can register signal handling routines. These are called when they receive signals from the oparating system. You can see a full list of signals using man 7 signal (or online here)

When you call kill, it sends a signal to the process. The default signal is SIGTERM (this is equivalent to kill -15, kill -TERM or simply kill) and the default behavior is for the app to quit. More sophisticated apps, probably including Skype, will set up a signal handling routine to properly close connections and perhaps save some session information.

When you do kill -9 (or its equivalent kill -KILL) you send SIGKILL. As explained in the signal man page, "The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored." This means that no signal handling routine will be executed and all the nice stuff that Skype's programmers put in to make their software behave on your system is ignored.

You should always try killing processes without -9 first. If that doesn't work, only then should you try kill -9.

Aside: You may see that some daemons support kill -HUP to reload configuration file. These programs have signal handlers configured to run when they receive SIGHUP. The kill program is named in a way to suggest that it always kills programs, but it's really just a way to send signals.

Doug Harris

Posted 2011-11-07T14:31:43.577

Reputation: 23 578

1

Hard to know unless you got Skype source code, which AFAIK is closed source. Anyway you should try kill -TERM first before attempting a more potentially more damaging kill -KILL. Also I suggest using -KILL instead of -9, it's more readable. You might also want to take a look at killall command.

m0skit0

Posted 2011-11-07T14:31:43.577

Reputation: 1 317