[Asterisk-Dev] Bug 3203 "Get RT without runaway risk" revisited

Kristian Nielsen kn at sifira.dk
Fri Aug 5 05:40:56 MST 2005


Kristian Nielsen <kn at sifira.dk> writes:

> This bug
> 
>     http://bugs.digium.com/view.php?id=3203
> 
> mentions several patches that implement a safeguard against running
> Asterisk with realtime priority on Linux. Without such a solution, an
> infinite loop anywhere in an Asterisk process running at realtime
> priority can effectively kill the machine, locking out all other
> processes (including root shells).
> 
> The bug has been suspended due to no activity, and we are now in the
> need for this feature. So I just wanted to ask if anyone has some code
> for this? Otherwise I will have a go at implementing it.

Ok, I wrote a simple wrapper script "asterisk_safe". This script forks
two subprocesses, one running asterisk at realtime priority with the
commandline specified, the other running a small watchdog loop at
non-realtime priority. The parent then sets itself to a high realtime
priority. Then if the parent detects cpu starvation for the watchdog
process, it lowers asterisk to non-realtime priority. If it detects
asterisk crash, the asterisk process is restarted.

The wrapper is written in Perl, and requires the Inline module. It also
only works on linux 2.4 as written. So it may not be ready for inclusion
in Asterisk as is, but I thought I would post it here anyway in case it
is useful to others.

 - Kristian.

-- 
Kristian Nielsen   kn at sifira.dk
Development Manager, Sifira A/S
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asterisk_safe
Type: text/x-perl
Size: 6171 bytes
Desc: asterisk_safe wrapper
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20050805/59a6ac76/asterisk_safe.pm


More information about the asterisk-dev mailing list