Summary:ASTERISK-03293: mpg123 Consuming 99% of the CPU
Reporter:eko1 (eko1)Labels:
Date Opened:2005-01-17 18:47:39.000-0600Date Closed:2011-06-07 14:10:46
Versions:Frequency of
Description:This has been talked about on the mailing list but I haven't seen anything concrete. I'm running Asterisk 1.0.3 STABLE on FC2. After about 3 days or so, top shows that mpg123 is consumming over 95% of the CPU. I have mpg123 0.59r. I've been having this problem since 1.0 STABLE.


I haven't been able to accurately pinpoint what conditions cause this to happen. I do reload and restart Asterisk a couple of times a day.
Comments:By: eko1 (eko1) 2005-01-17 18:50:32.000-0600

Uh, why is the Category ADSI?! That was dumb. The Category should be General.

By: Mark Spencer (markster) 2005-01-17 20:40:40.000-0600

Downgrading to minor since obviously this doesn't significantly affect Asterisk's operation.

By: Brian West (bkw918) 2005-01-17 21:21:28.000-0600

strip the id3 tags... and if you can tell me what bitrates the mp3's are?


By: Mark Spencer (markster) 2005-01-17 21:24:01.000-0600

When it gets stuck, what do you see if you strace -p the mpg123 process?

By: twisted (twisted) 2005-01-17 21:55:46.000-0600

i don't even see how mpg123 problems are asterisk problems...?

By: eko1 (eko1) 2005-01-18 08:51:00.000-0600

It doesn't significantly affect Asterisk's operation?! I disagree. Last Sunday (last time I had this problem), Asterisk was showing me this on the CLI:

Jan 16 09:57:39 WARNING[6125]: Unable to allocate channel structure
Jan 16 09:57:39 NOTICE[6125]: Unable to create/find channel

everytime I tried to make a call. I had to kill all of the mpg123 processes and I had to restart Asterisk. I consider this significant. But anywho...

I'm using the 'standard' mp3 files that are in /var/lib/asterisk/mohmp3: fpm-calm-river.mp3, fpm-sunshine.mp3, fpm-world-mix.mp3.

The next time I see this problem, I'll do a strace.

By: Mark Spencer (markster) 2005-01-18 10:47:12.000-0600

That message has nothing to do with mpg123 but would be more indicative of running out of memory.  If you get Asterisk back in that state, perhaps someone can login and try to analyze how it got there, but in any case it's got nothing to do with an mpg123 running away.

By: eko1 (eko1) 2005-01-18 14:07:40.000-0600

Here is what basically happened that Sunday morning:
- I get a phone call about the phones at the office not working.
- I log into my Asterisk server and did a 'service asterisk restart'
- I log back into Asterisk and notice these messages flooding the screen:

Jan 16 09:57:39 WARNING[6125]: Unable to allocate channel structure
Jan 16 09:57:39 NOTICE[6125]: Unable to create/find channel

- I immediately do a top, and notice an mpg123 process using 99% of the CPU.
- I shutdown Asterisk and do a 'pkill mpg123'
- I 'top' again and everything is back to normal
- I restart Asterisk

Judging by the sequence of events, I would say mpg123 was to blame. Let's see if it happens again by the end of this week.

By: Mark Spencer (markster) 2005-01-18 14:44:02.000-0600

Shutting down asterisk without asterisk -rx "shutdown now" will often leave runaway mpg123 processes due to a bug in mpg123.  When you do asterisk -rx "shutdown now" then asterisk gets the chance to kill off the mpg123 processes.

The messages you saw are indicative of a codec negotiation problem that has been resolved in Asterisk CVS head as of several days ago.