Summary: | ASTERISK-10970: safe_asterisk fails to restart asterisk after crash | ||
Reporter: | Matthew M. Boedicker (mmb) | Labels: | |
Date Opened: | 2007-12-04 09:12:27.000-0600 | Date Closed: | 2011-06-07 14:03:06 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | If safe_asterisk is started from a terminal, it works as expected. If it is started from the init script, it will not restart the asterisk process. I believe this is due to safe_asterisk writing to stderr when it is not being redirected anywhere. The init script that calls safe_asterisk should redirect stderr because I don't think the daemon function does. tested on CentOS 4.5 ****** ADDITIONAL INFORMATION ****** Non-working case (safe_asterisk started from init script): [root@box ~]# service asterisk start Starting asterisk: [ OK ] [root@box ~]# ps auxgww | grep aster root 18618 0.0 0.0 6160 528 pts/2 S 10:00 0:00 /bin/sh /usr/sbin/safe_asterisk root 18662 6.5 0.3 20328 7676 pts/2 Sl 10:00 0:00 /usr/sbin/asterisk -vvvg -c root 18769 0.0 0.0 4164 628 pts/2 S+ 10:00 0:00 grep aster [root@box ~]# kill -11 18662 [root@box ~]# ps auxgww | grep aster root 18797 0.0 0.0 5504 628 pts/2 S+ 10:00 0:00 grep aster [root@box ~]# Working case (safe_asterisk started from terminal): [root@box ~]# /usr/sbin/safe_asterisk [root@box ~]# ps auxgww | grep aster root 19156 0.0 0.0 4864 524 pts/2 S 10:02 0:00 /bin/sh /usr/sbin/safe_asterisk root 19196 7.7 0.3 20064 7680 pts/2 Sl 10:02 0:00 /usr/sbin/asterisk -vvvg -c root 19299 0.0 0.0 3880 628 pts/2 S+ 10:02 0:00 grep aster [root@box ~]# kill -11 19196 [root@box ~]# /usr/sbin/safe_asterisk: line 111: 19196 Segmentation fault (core dumped) nice -n $PRIORITY ${ASTSBINDIR}/asterisk ${CLIARGS} ${ASTARGS} >&/dev/${TTY} </dev/${TTY} Asterisk ended with exit status 139 Asterisk exited on signal 11. Automatically restarting Asterisk. mpg123: no process killed [root@box ~]# ps auxgww | grep aster root 19156 0.0 0.0 4872 680 pts/2 S 10:02 0:00 /bin/sh /usr/sbin/safe_asterisk root 19363 2.1 0.3 20256 7680 pts/2 Sl 10:02 0:00 /usr/sbin/asterisk -vvvg -c root 19466 0.0 0.0 5328 628 pts/2 S+ 10:02 0:00 grep aster [root@box ~]# | ||
Comments: | By: Phoebe Anderson (phoebe) 2007-12-05 08:10:57.000-0600 Are you using something like bootsplash? If so, try launching safe_asterisk using "setsid" from your init script. By: Matthew M. Boedicker (mmb) 2007-12-05 08:24:43.000-0600 Not using anything like bootsplash. What starts asterisk is: init script -> daemon function -> initlog -> safe_asterisk -> nice -> asterisk By: Terry Wilson (twilson) 2007-12-12 14:17:17.000-0600 Last I checked, redhat-based distros didn't do this correctly. Problem (if it is still the same) was how the daemon() function for initscripts calls safe_asterisk. Seems like I had to remove initlog from call to get it to work right. Will put together a test box and see if I can find a fix. By: Terry Wilson (twilson) 2007-12-12 14:23:34.000-0600 Actually it was initlog -c changed to initlog -r: http://bugs.digium.com/view.php?id=901 Hopefully can find a solution that works with initlog -c ... of course, Fedora 8 has initlog as deprecated and the script works there, so eventually this won't be a problem. By: Matthew M. Boedicker (mmb) 2007-12-12 15:39:06.000-0600 A temporary fix that seemed to work, however this bypasses initlog competely: In /etc/init.d/asterisk: Change: daemon $DAEMON $ASTARGS to: nohup $DAEMON $ASTARGS By: Terry Wilson (twilson) 2007-12-12 19:10:11.000-0600 also Centos 5.1 works fine (no initlog). By: Tilghman Lesher (tilghman) 2008-01-07 15:07:03.000-0600 Okay, I think this is clearly a distroy specific issue, that has been fixed (or will be fixed) in later versions, so no fix needs to go into Asterisk. |