[linux-audio-user] Tracking down overruns

Jan Depner eviltwin69 at cableone.net
Sun Sep 14 09:10:01 EDT 2003

Really nice!  I'm an old UNIX guy so I just used the brute force
method.  I did forget to add that I kill syslogd and crond before I run


On Sun, 2003-09-14 at 03:13, James Cameron wrote:
> On Sat, Sep 13, 2003 at 03:09:26PM -0500, Jan Depner wrote:
> > killall -9 autorun 2>/dev/null
> > killall -9 artsd 2>/dev/null
> > killall -9 jackd 2>/dev/null          [and so forth ...]
> This sequence can be simplified and made a little more safe.
> a) use "--quiet" instead of "2>/dev/null", so that any failure to run
>    killall is not hidden, yet it won't complain if there are no 
>    processes with that name,
> b) use "--signal KILL" instead of "-9", to ease later understanding,
> c) use "--wait" as well, so that potential timing issues are excluded
>    (if you did the sequence of killall's at higher priority than the
>    processes you have killed, then it is theoretically possible for you
>    to start new processes before the processes you killed have actually
>    died, and these new processes may therefore not run as expected ...
>    the technical term is "race condition".)
> d) test for and use just the default SIGTERM signal, as there are some
>    programs that need to undo some of the work they have done, and a
>    SIGKILL (the -9) allows them no chance to do so.  (An example are
>    programs that create permanent shared memory segments or other IPC
>    arcania; and then only delete them properly if not SIGKILLed.)
>    A rule of thumb is to prove to yourself that SIGTERM doesn't work
>    before adopting SIGKILL.
> e) place the commands in a file in /usr/local/bin or $HOME/bin, include 
>    that directory in your PATH, make sure the file is executable 
>    "chmod +x killit", and add a "set -v", so that when you run it you can
>    immediately see it's progress.  If you've never written a file 
>    containing commands to execute, have a go, you'll love the idea.
> #!/bin/sh
> set -v
> killall --quiet --wait --signal KILL autorun
> killall --quiet --wait --signal KILL artsd
> killall --quiet --wait --signal KILL jackd
> rm -rf /tmp/jack*
> killall --quiet --wait --signal KILL /usr/lib/ardour/ardourx
> killall --quiet --wait --signal KILL oafd
> killall --quiet --wait --signal KILL xbiff
> killall --quiet --wait --signal KILL envy24control
> killall --quiet --wait --signal KILL /usr/bin/aplay
> f) and to really go all the way, do some "factoring" to make it easier 
>    to add new programs ... although this is no use if programs need 
>    different signals:
> #!/bin/sh
> set -x
> for PROCESS in autorun artsd jackd /usr/lib/ardour/ardourx oafd \
>                xbiff envy24control /usr/bin/aplay; do
>     killall --quiet --wait --signal KILL $PROCESS
> done
> rm -rf /tmp/jack*
> References:
> man 7 signal
> man 1 killall
> man 1 bash
> tested on Debian GNU/Linux and Red Hat 9
> -- 
> James Cameron    mailto:quozl at us.netrek.org     http://quozl.netrek.org/

More information about the Linux-audio-user mailing list