[asterisk-dev] astcanary exits immediately in 10.12.0

Jakob Hirsch jh at plonk.de
Thu Jan 17 03:38:05 CST 2013


Hi,

I wanted to update our machines to 10.12.0 (as an intermediate update
until we upgrade to 11) and noticed that astcanary is not running any
more, not even right after starting asterisk, resulting in asterisk to
reduce it's priority (with a rather lengthy and slightly annoying
message). This only happens when starting asterisk in the background,
though.

With strace I found out that astcanary being started with a wrong ppid:

> 29358 18:19:04.138884 execve("/usr/sbin/astcanary", ["astcanary", "/var/run/asterisk/alt.asterisk.c"..., "29356"], [/* 28 vars */] <unfinished ...>
...
> 29358 18:19:04.146543 setpriority(PRIO_PROCESS, 0, 0 <unfinished ...>
> 29358 18:19:04.146568 <... setpriority resumed> ) = 0
> 29358 18:19:04.146593 getppid( <unfinished ...>
> 29358 18:19:04.146633 <... getppid resumed> ) = 29357
> 29358 18:19:04.146663 exit_group(0)     = ?

Notice 29356 vs. 29357.

The reason is obviously a change made to main/asterisk.c. In 10.11.1,
ast_mainpid is updated right after daemon(), in 10.12.0 it is updated
_after_ astcanary is started, so astcanary gets the old pid (the process
starting doing the daemon()).

Trivial fix (with a little cleanup) is attached. If you need an issue in
your JIRA for this, I can do that too.


Regards
J
-------------- next part --------------
A non-text attachment was scrubbed...
Name: asterisk-10.12.0.astcanary_ppid.diff
Type: text/x-patch
Size: 930 bytes
Desc: not available
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130117/5866cecd/attachment.bin>


More information about the asterisk-dev mailing list