safe_asterisk [was: Re: Bug#433779: asterisk doesn't work correctly after boot]
Tzafrir Cohen
tzafrir.cohen at xorcom.com
Mon Aug 20 05:25:03 UTC 2007
Following up just on the list, maybe we shoud open a separate bug. I
suspect that it is still present in SID (when one uses the non-default
option of safe_asterisk in the init.d script)
On Thu, Jul 19, 2007 at 01:56:18PM +0200, Hasse Hagen Johansen wrote:
> Package: asterisk
> Version: 1:1.2.13~dfsg-2
> The following is a ps after booting my machine and then a restart:
>
> deckard:~# ps -ef|grep aster
> root 5275 1 0 13:41 ? 00:00:00 /bin/sh /usr/sbin/safe_asterisk -p -U asterisk
> asterisk 5284 5275 4 13:41 ? 00:00:03 /usr/sbin/asterisk -p -U asterisk -vvvg -c
> root 5769 5507 0 13:42 pts/0 00:00:00 grep aster
> deckard:~# /etc/init.d/asterisk restart
> Stopping Asterisk PBX: asteriskstart-stop-daemon: warning: failed to
> kill 5273: No such process
> .
> Starting Asterisk PBX: asterisk.
The PID file seems to be generated by start-stop-daemo for safe_asterisk
. Then safe_asterisk forks or whatever and gets a newer PID.
start-stop-daemon is not very robust. It probably needs a total rewrite.
Users don't exaclty realise that it by default leaves Asterisk running
on a TTY as root, and hence provides automatic access to asterisk to
whoever has physical access to the system.
OTOH, it can't even be run from a terminal in screen.
And there are simply too many ways to get two copies of safe_asterisk
running, or to get safe_asterisk to cause asterisk to loop.
Which is why I normally don't recommend it to anybody. It doesn't
necessarily increase availbility, and it increases complexity.
One deeper problem is that some common failures of Asterisk are
manifested by errors of loading modules, and they all happen the
asterisk daemon has detached. I wonder if there's any clean way to have
the daemonizing asterisk report such errors in its return status or any
similr way. But it can't detach too late, or otherwise dropping
priivleges and such becomes a problem.
safe_asterisk's solution to that was not to daemonize at all. But this
means you have to have a console (depend on screen? recommend screen?)
--
Tzafrir Cohen
icq#16849755 jabber:tzafrir at jabber.org
+972-50-7952406 mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com iax:guest at local.xorcom.com/tzafrir
More information about the Pkg-voip-maintainers
mailing list