[Home]

Summary:ASTERISK-09480: reload command causes asterisk to crash
Reporter:Mats Karlsson (matsk)Labels:
Date Opened:2007-05-21 06:42:07Date Closed:2007-07-11 19:59:06
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_minivm.c.patch
( 1) bt.txt
( 2) bt-full.txt
( 3) dump.txt
( 4) thread-apply-all-bt.txt
Description:Asterisk crashes when running the reload command

****** STEPS TO REPRODUCE ******

rasterisk
reload

gdb asterisk /tmp/corefile "To produce the attachement"
Comments:By: Joshua C. Colp (jcolp) 2007-05-22 07:51:50

This backtrace doesn't have any useful information. Can you reproduce this? Do you have the console output from when it crashed?

By: Mats Karlsson (matsk) 2007-05-22 14:40:56

I just recompiled Asterisk with latest SVN (65298) and to replroduce it, is easy I just have to type "reload"

localhost*CLI> reload
localhost*CLI>
Disconnected from Asterisk server
/usr/sbin/safe_asterisk: line 117: 10635 Segmentation fault      (core dumped) nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >&/dev/${TTY} </dev/${TTY}
Asterisk ended with exit status 139
Asterisk exited on signal 11.
Automatically restarting Asterisk.

By: Mike Anikienko (mike anikienko) 2007-05-25 12:42:56

I have same problem in SVN-trunk-r66178M. But at second reload after start asterisk.
I add bt files.

By: Eliel Sardanons (eliel) 2007-05-26 13:11:43

maybe it has something to do with bug ASTERISK-952714? try my patch.

Ref.: http://bugs.digium.com/view.php?id=9814



By: Mats Karlsson (matsk) 2007-05-26 14:14:06

Since I'm lousy on patching (but eager to learn) and programming I did another test.

I did an "unload app_minivm.so" and after that was I unable to force a crash, so I conlude that it seems resonable that app_minivm.so is causing the trouble.

By: Mats Karlsson (matsk) 2007-05-26 15:39:41

Revision: 66225

By: Mats Karlsson (matsk) 2007-05-26 16:11:28

SVN 66225 added changes to app_minivm.c did't resolv this bug as well, it seems that there is needed more reload's in fast sucsession (8-9) before a crach is happening.

localhost*CLI> reload
localhost*CLI>
Disconnected from Asterisk server
[root@localhost asterisk]# /usr/sbin/safe_asterisk: line 117: 10764 Segmentation fault      (core dumped) nice -n $PRIORITY ${ASTSBINDIR}/asterisk -f ${CLIARGS} ${ASTARGS} >&/dev/${TTY} </dev/${TTY}
Asterisk ended with exit status 139
Asterisk exited on signal 11.
rasterisk Automatically restarting Asterisk.

By: Mats Karlsson (matsk) 2007-05-26 16:14:23

Fix in SVN 66225 didn't fix the "reload causes asterisk to crash" but it is harder to cause a crash now, so it fixed it partly.

By: Eliel Sardanons (eliel) 2007-05-26 16:55:15

Matsk,
     do you have a backtrace of that crash? (until 9 reload's).

Thanks

By: Eliel Sardanons (eliel) 2007-05-26 16:57:55

You are right, I could reproduce it.

By: Eliel Sardanons (eliel) 2007-05-26 18:10:36

The problem is while freeing the minivm_zones linkedlist:
AST_LIST_LOCK(&minivm_zones);
       while ((this = AST_LIST_REMOVE_HEAD(&minivm_zones, list))) {
               free_zone(this);
       }
AST_LIST_UNLOCK(&minivm_zones);

In timezone_destroy_list() and in load_config();

If I comment the AST_LIST_REMOVE... from timezone_destroy_list, then the problem appears in load_config().

By: Eliel Sardanons (eliel) 2007-05-26 20:18:34

This didn't solve the issue...

if (AST_LIST_EMPTY(&minivm_zones))
   return;

The Macro is referencing a null pointer (I think... but dont know why).

By: Mike Anikienko (mike anikienko) 2007-05-27 10:08:35

Yes, I too confirm problem in app_minivm.so.
modules.conf:
noload=app_minivm.so
solve problem with reload.

By: Eliel Sardanons (eliel) 2007-05-27 14:32:42

strange:
      the problem is when I do a 'module reload' of all the modules. Not when I do just a reload of app_minivm.so (modules reload app_minivm.so). But asterisk crash while doing app_minivm.so reload...

By: Eliel Sardanons (eliel) 2007-05-27 14:42:23

sorry. It crash always.. with module reload and with module reload app_minivm.so.

By: Eliel Sardanons (eliel) 2007-05-29 23:14:29

I think found the problem but not yet the solution... someone is writing over minivm_zones, so, while trying to free minivm_zones head->first != NULL...
I have found in head->first strings like 'MANR' (a part of USERNAME), and ' ,%A' (a part of dateformat)... My conclusion is that  minivm_template is the one overwriting minivm_zones...  

I hope this could help..

By: Eliel Sardanons (eliel) 2007-05-30 21:11:31

Pufff! That was hard for me... but finally arrive to the solution.. try this patch.

I notice a lot more stuff that needs to be changed in app_minivm.c I will report that changes in a new issue.

By: Eliel Sardanons (eliel) 2007-05-30 21:17:26

Disclaimer is on file. (app_minivm.c.patch)

By: Mats Karlsson (matsk) 2007-05-31 03:29:30

Applied patch to SVN-trunk-r66208M and it solved the "reload causes crash" on my system. Thanx eliel for the work.

By: Russell Bryant (russell) 2007-05-31 09:52:18

This patch has been added to trunk in revision 66724.  Thanks!