I am running sox to record wav from the audio device on FreeBSD 9.0-STABLE amd64.
When during this process system gets very busy and slow, sox is likely to get into 100% CPU and can't be killed with 'kill' (SIGTERM) or Ctrl-C (SIGINT).
Since it is unkillable by SIGINT/SIGTERM, I assume sox handles signals and ignores them. I was only able to kill it with kill -9 which left invalid wav file (which is natural with kill -9).
When the system slows down it probably produces fewer sound samples than expected, which triggers the problem in sox.
Such sox behavior is wrong. It should never cycle with 100% CPU and gets unkillable no matter what sound input it gets.
I also think that Input (alsa) that sox prints is wrong since FreeBSD doesn't support alsa. It is either OSS or pulseaudio.
--- output of top ---
PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
63966 yuri 1 103 0 147M 9156K CPU6 6 5:33 100.00% sox
--- console ---
Input File : 'default' (alsa)
Channels : 1
Sample Rate : 48000
Precision : 16-bit
Sample Encoding: 16-bit Signed Integer PCM
In:0.00% 00:16:07.51 [00:00:00.00] Out:46.4M [ -====|====- ] Clip:0 ^C^C^C^C^C^C^C^C^C^C^C^C^C