Summary:ASTERISK-07400: [patch] coredump on hangup when compiled with MALLOC_DEBUG
Reporter:Kaloyan Kovachev (knk)Labels:
Date Opened:2006-07-26 03:23:10Date Closed:2006-07-26 20:50:41
Versions:Frequency of
Environment:Attachments:( 0) core.11968.txt
( 1) mmlog.gz
( 2) threadstoragebreakage.patch
Description:After the call is completed and h extension is processed i get
*** glibc detected *** free(): invalid pointer: 0x0000000000xxxxxx ***
Aborted (core dumped)

I have traced to problem to start at revision 38042 (38041 is fine)
Comments:By: Kaloyan Kovachev (knk) 2006-07-26 05:23:54

related to bug 7484 - see note 0049494

By: Serge Vecher (serge-v) 2006-07-26 09:10:11

assigning to Russell as r38042 was part of his thread local storage work.

By: Kaloyan Kovachev (knk) 2006-07-26 09:25:18

I don't think there is something wrong with that patch, but with the replacments functions when MALLOC_DEBUG is enabled

By: Kaloyan Kovachev (knk) 2006-07-26 11:05:05

not sure if it will be of any help, but commenting out the calloc macro in /include/asterisk/astmm.h (line 59) have fixed this one, but not 7484

on hangup asterisk didn't crashed, but at the cli and in mmlog there were lots of warnings, then i have reloaded extensions, which caused asterisk to crash.

attaching the mmlog file in case it will be of any help. Up to line 67 (before the first appearence of 'ast_variable_destroy') are the warnings before 'extensions reload'

By: Russell Bryant (russell) 2006-07-26 11:43:58

All of those warnings you see if your mmlog are because it did not know about that  memory being allocated due to commenting out the macro in astmm.h.  However, when it got free'd, it did go through the memory manager and it got upset.  :)

I am looking into this, as well as 7484, trying to reproduce it and figure out the best way to fix it.

By: Russell Bryant (russell) 2006-07-26 11:53:24

I have uploaded a patch which I am hoping will resolve your issues.  Please test and let me know what happens.

By: Russell Bryant (russell) 2006-07-26 20:50:24

I have committed this patch since I believe it will fix your problem.  If it does not, please reopen this bug.  Thanks!

By: Russell Bryant (russell) 2006-07-26 20:50:41

By the way, the patch was committed in rev 38286