Summary:ASTERISK-04909: core dump with astmm
Reporter:Roy Sigurd Karlsbakk (rkarlsba)Labels:
Date Opened:2005-08-26 03:36:54Date Closed:2008-01-15 15:56:16.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 20050930-233543-cest.backtrace.txt
( 1) 20050930-233544-cest.backtrace.txt
( 2) bt.txt
( 3) btfull.txt
( 4) newbt.txt
( 5) newbt2a.txt
( 6) yetanotherbtfull.txt
Description:if compiling with astmm, asterisk core dumps after a short while. attached are backtrace for this
Comments:By: Kevin P. Fleming (kpfleming) 2005-08-26 16:58:44

This is not MAJOR, since Asterisk is not expected to operate in production mode with astmm enabled, it is solely for debugging purposes.

By: Kevin P. Fleming (kpfleming) 2005-08-26 17:01:33

Your backtrace is not useful, since Asterisk was built with optimization (obvious from the backtrace since ast_cli_command() does not call handle_commandmatchesarray() directly).

Please try to follow the proper process for producing a backtrace so we can have some hope of finding the problem :-)

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-08-27 12:29:47

sorry about the major flag, then. i just thought it was so since there's no workaround without disabling the entire function, as in 'bug in chan_sip - oh you can always noload => chan_sip.so' :P

I'll send a new one as soon as i can...

By: Michael Jerris (mikej) 2005-09-07 22:39:49

Time to bring this one back to life now that you can compile using valgrind and astmm.  Please provide a non optimized backtrace of this issue for review.  Thanks.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-08 08:35:54

Unable to reproduce this with current CVS HEAD, so just close this and I'll open it if the problem returns



By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-09 07:53:30

another crash

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-23 12:59:10

the new backtrace has been there a couple of weeks now.
can someone please take a look at this?
IMHO astmm is very important to keep track of potential leaks in asterisk


By: Mark Spencer (markster) 2005-09-24 11:28:44

This appears to have actually been an issue in the CLI handling itself.  Fixed in CVS head.

By: Russell Bryant (russell) 2005-09-24 17:22:53

fixed in 1.0 as well

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-25 10:43:10

new crash

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-25 10:45:19

please delete newbt2.txt

By: Mark Spencer (markster) 2005-09-29 00:38:17

I've added some additional debugging.  Please update and let me know if that helps or produces additional output, especially in /var/log/asterisk/mmlog.

By: Mark Spencer (markster) 2005-09-29 00:38:51

Also please confirm this is *completely* unpatched sources and that there are *no* other modules outside of the normal asterisk build tree that are being linked in.  Thanks!

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-29 04:59:35

this is a fresh cvs build made with make valgrind
CVS Thu Sep 29 11:58:27 CEST 2005
the only change compared to CVS is that astmm is enabled

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-30 16:40:33

current, fresh backtrace for current CVS just uploaded
this contains two backtraces for two slightly different crashes, although I beleive it's the same

btw, am I the only one using astmm for monitoring asterisk memory during tests?


By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-30 16:42:57

i'll upload another without optimisations :P

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-30 16:47:29

there it goes
now with make valgrind
it looks the same, though

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-09-30 16:50:01

hm. interesting

sipgw2*CLI> show uptime
System uptime: (null)
sipgw2*CLI> show uptime
System uptime: (null)
sipgw2*CLI> sip show channels
Disconnected from Asterisk server

By: Clod Patry (junky) 2005-10-04 21:15:46

I see some code related to manager.c, since there was few changes, could you try with latest HEAD?
Thanks for your patience.

By: Olle Johansson (oej) 2005-10-25 04:11:12

Any updates? Does the problem still exist? Which developer looks into this problem? Can anyone repeat it on Linux or other platforms?


By: Roy Sigurd Karlsbakk (rkarlsba) 2005-10-25 04:59:56

- update to latest cvs
- uncomment astmm in the main makefile
- make valgrind
- start asterisk

run a few 'show channels' or any command at all, and it crashes...

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-10-25 05:00:30

and, yes, this is on linux...

By: Olle Johansson (oej) 2005-10-25 13:20:25

Can repeat this on Fedora Core. "show modules" kills asterisk.

By: Kevin P. Fleming (kpfleming) 2005-11-08 21:28:39.000-0600

I cannot reproduce this following those exact steps :-(

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-11-09 05:28:40.000-0600

it doesn't necessarily crash on the first command, but rather after some 5-10 of them
right now it crashed on the first. this does not happen with a normal 'make', only 'make valgrind'

*CLI> show modules
Segmentation fault (core dumped)

backtrace looks the same

#0  0x00002aaaab380ce6 in strnlen () from /lib/libc.so.6
#1  0x00002aaaab34ece5 in vfprintf () from /lib/libc.so.6
#2  0x00002aaaab373c76 in vsnprintf () from /lib/libc.so.6
#3  0x0000000000478027 in __ast_vasprintf (strp=0x7fffff87c228, fmt=0x4b5c4c "%-30s %-40.40s %-10s\n", ap=0x7fffff87c230, file=0x4b5ad5 "cli.c", lineno=67,
   func=0x4b6500 "ast_cli") at astmm.c:261
#4  0x00000000004489df in ast_cli (fd=1, fmt=0x28 <Address 0x28 out of bounds>) at cli.c:67

this is a fresh cvs checkout on the following date/arch

sipgw2:/usr/src/asterisk# date
Wed Nov  9 12:03:45 CET 2005
sipgw2:/usr/src/asterisk# uname -a
Linux sipgw2 2.6.14 #1 SMP PREEMPT Sat Nov 5 17:36:41 CET 2005 x86_64 GNU/Linux

i can't seem to reproduce this on this box

Linux pstngw1 #2 SMP Thu Jul 14 12:55:29 BST 2005 i686 i686 i386 GNU/Linux

so perhaps it's a x86_64 problem?


By: Olle Johansson (oej) 2005-11-09 06:20:35.000-0600

I was testing on AMD 64...

By: Kevin P. Fleming (kpfleming) 2005-11-15 21:31:17.000-0600

This should now be fixed in CVS HEAD; the vasprintf() implementation in astmm.c had a bug which was fixed some time ago in the utils.c version; they now use the same implemention, except for the memory allocation method.

By: Digium Subversion (svnbot) 2008-01-15 15:48:52.000-0600

Repository: asterisk
Revision: 6635

U   trunk/cli.c

r6635 | markster | 2008-01-15 15:48:52 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix CLI memory leak (bug ASTERISK-4909)



By: Digium Subversion (svnbot) 2008-01-15 15:48:53.000-0600

Repository: asterisk
Revision: 6636

U   branches/v1-0/cli.c

r6636 | russell | 2008-01-15 15:48:53 -0600 (Tue, 15 Jan 2008) | 2 lines

Fix CLI memory leak (issue ASTERISK-4909)



By: Digium Subversion (svnbot) 2008-01-15 15:56:16.000-0600

Repository: asterisk
Revision: 7110

U   trunk/ChangeLog
U   trunk/astmm.c

r7110 | kpfleming | 2008-01-15 15:56:16 -0600 (Tue, 15 Jan 2008) | 2 lines

issue ASTERISK-4909