[Home]

Summary:ASTERISK-06618: process forked by MoH is not killed on asterisk shutdown
Reporter:Roy Sigurd Karlsbakk (rkarlsba)Labels:
Date Opened:2006-03-25 10:02:17.000-0600Date Closed:2006-04-19 19:21:31
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_musiconhold
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:using mpg123 or, in my case, a sox wrapper for custom music-on-hold leaves the forked process when shutting down or restarting asterisk. the process is then left spinning, using 100% cpu.
Comments:By: Tilghman Lesher (tilghman) 2006-03-25 10:54:34.000-0600

Actually, we DO kill it on shutdown.  The only time the MOH process is not killed is when there's a crash in the Asterisk process, in which case, there's no way we can execute any cleanup.

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-03-25 11:06:55.000-0600

with asterisk running, i have these

28141 ?        S      0:00 /bin/sh /usr/sbin/safe_asterisk
28143 ?        S     66:36  \_ asterisk -vvvg -c
28152 ?        S      0:00      \_ /bin/bash /usr/local/bin/soxwrapper 02_On_your_side.mp3 03_Hold_on_to_you.mp3 04_Stories_from_the_street.mp3 05_Running_out_of_time.mp3 06_The_lost_gospel.mp3 07_Electro_Vakuum.mp3 08_Subterranean_Sunlight.mp3 09_Hard_to_come_back.mp3 10_Ramona.mp3 11_Slow_builder.mp3 12_Sail_away.mp3 01_The_kids_are_in_high_street.mp3
28156 ?        S      0:00      |   \_ /usr/local/bin/sox 02_On_your_side.mp3 03_Hold_on_to_you.mp3 04_Stories_from_the_street.mp3 05_Running_out_of_time.mp3 06_The_lost_gospel.mp3 07_Electro_Vakuum.mp3 08_Subterranean_Sunlight.mp3 09_Hard_to_come_back.mp3 10_Ramona.mp3 11_Slow_builder.mp3 12_Sail_away.mp3 01_The_kids_are_in_high_street.mp3 -r 8000 -v 0.25 -w -c 1 -t wav -

then issuing a 'stop now', and i get one process left

28156 ?        R      0:12 /usr/local/bin/sox 02_On_your_side.mp3 03_Hold_on_to_you.mp3 04_Stories_from_the_street.mp3 05_Running_out_of_time.mp3 06_The_lost_gospel.mp3 07_Electro_Vakuum.mp3 08_Subterranean_Sunlight.mp3 09_Hard_to_come_back.mp3 10_Ramona.mp3 11_Slow_builder.mp3 12_Sail_away.mp3 01_The_kids_are_in_high_street.mp3 -r 8000 -v 0.25 -w -c 1 -t wav -

that runs and eats 100% CPU

the sox wrapper is simply this: /usr/local/bin/sox $@ -r 8000 -v 0.25 -w -c 1 -t wav -

this is 1.2 rev 14659

roy

By: Tilghman Lesher (tilghman) 2006-03-25 12:12:48.000-0600

That is not Asterisk's fault.  As you can plainly see, Asterisk correctly killed the process that it spawned.  It cannot be responsible for any processes that that process spawned.

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-03-26 12:48:40.000-0600

Strange thing is, the process keeps spinning. Perhaps asterisk should take care of a spawned proess's children as well? In other cases, if killing PID A whos child is B, B gets killed by the OS. This, however, does not happen here.

roy

By: Tilghman Lesher (tilghman) 2006-03-26 12:54:18.000-0600

I looked for a kernel call kill_process_and_all_of_its_children(2) but I couldn't find it.  Perhaps you know where it can be found?

By: Tilghman Lesher (tilghman) 2006-04-19 14:30:27

Fixed

By: Roy Sigurd Karlsbakk (rkarlsba) 2006-04-19 14:41:46

Out of interest, how and where was this fixed?

By: Joshua C. Colp (jcolp) 2006-04-19 19:21:03

It was fixed in revision 20966 for 1.2 and 21002 for trunk. If you want to see where it was fixed, look on the SVN mailing list - it'll show you the exact code that was affected or grab Corydon online or look at the patch.