[asterisk-bugs] [JIRA] (ASTERISK-20948) astcanary exits immediately because of wrong pid argument
Matt Jordan (JIRA)
noreply at issues.asterisk.org
Thu Jan 17 09:13:46 CST 2013
Matt Jordan created ASTERISK-20948:
--------------------------------------
Summary: astcanary exits immediately because of wrong pid argument
Key: ASTERISK-20948
URL: https://issues.asterisk.org/jira/browse/ASTERISK-20948
Project: Asterisk
Issue Type: Bug
Security Level: None
Components: Utilities/astcanary
Affects Versions: 10.12.0
Environment: all that HAVE_WORKING_FORK
Reporter: Jakob Hirsch
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()) and therefore exits immediately because it checks the ppid argument against the return value of getppid().
The easy fix is to update ast_mainpid after daemon(), as in the attached patch.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the asterisk-bugs
mailing list