[asterisk-bugs] [Asterisk 0014562]: [patch] safe_asterisk can get multiple instances if killproc escalates to SIGKILL in service asterisk restart

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Oct 30 10:15:32 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=14562 
====================================================================== 
Reported By:                davidw
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   14562
Category:                   General
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           SVN 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-02-26 12:37 CST
Last Modified:              2009-10-30 10:15 CDT
====================================================================== 
Summary:                    [patch] safe_asterisk can get multiple instances if
killproc escalates to SIGKILL in service asterisk restart
Description: 
Weird behaviour was observed in which we got Remote UNIX connection and
disconnections continuously repeated.  It turned out that we had two copies
of safe_asterisk running.

Although I didn't do this myself, I believe this was the result of using
"service asterisk restart" on an asterisk that was in distress (deadlock,
at least).  I think what happened is that the killproc escalated to
SIGKILL, which was not recognized by the original safe_asterisk, so it
continued to run.  Meanwhile the new safe_asterisk was started, but both
checks for a running asterisk failed, either because it was too much in
distress, or because the console listener had shut down in response to
killproc's SIGTERM.
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0015846 Asterisk is looking in the wrong locati...
====================================================================== 

---------------------------------------------------------------------- 
 (0112935) davidw (reporter) - 2009-10-30 10:15
 https://issues.asterisk.org/view.php?id=14562#c112935 
---------------------------------------------------------------------- 
Looks OK, except that it messes up the progress messages.  Will upload
revised version.

Tried using kill -STOP on asterisk to simulate deadlock.  Without the
patch the result was:

[root at centos init.d]# kill -STOP 756
[root at centos init.d]# service asterisk restart
Shutting down asterisk: /usr/sbin/safe_asterisk: line 146:   756 Killed   
     
         nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS}
> /de
v/${TTY} 2>&1 < /dev/${TTY}
Asterisk ended with exit status 137
Asterisk exited on signal 9.
Automatically restarting Asterisk.
[  OK  ]
Starting asterisk: [  OK  ]
[root at centos init.d]# mpg123: no process killed
Asterisk ended with exit status 1
Asterisk died with code 1.
Automatically restarting Asterisk.
mpg123: no process killed
Asterisk ended with exit status 1


With the patch:
[root at centos init.d]# ps -e | grep asterisk
 1390 pts/1    00:00:00 safe_asterisk
 1400 pts/1    00:00:00 asterisk
[root at centos init.d]# kill -STOP 1400
[root at centos init.d]# service asterisk restart
[  OK  ] down asterisk: [  OK  ]
Starting asterisk: [  OK  ]
[root at centos init.d]# ps -e | grep asterisk
 1544 pts/1    00:00:00 safe_asterisk
 1554 pts/1    00:00:00 asterisk

As modified: 
[root at centos init.d]# ps  -e | grep asterisk
 1825 pts/1    00:00:00 safe_asterisk
 1831 pts/1    00:00:01 asterisk
[root at centos init.d]# kill -STOP 1831
[root at centos init.d]# service asterisk restart
Stopping safe_asterisk: [  OK  ]
Shutting down asterisk: [  OK  ]
Starting asterisk: [  OK  ]
[root at centos init.d]# ps -e | grep asterisk
 2402 pts/1    00:00:00 safe_asterisk
 2412 pts/1    00:00:02 asterisk 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-10-30 10:15 davidw         Note Added: 0112935                          
======================================================================




More information about the asterisk-bugs mailing list