Summary:ASTERISK-25383: Core dumps on startup and shutdown with MALLOC_DEBUG enabled
Reporter:yaron nahum (yaronna)Labels:
Date Opened:2015-09-09 08:35:10Date Closed:2015-09-29 13:27:19
Status:Closed/CompleteComponents:Core/BuildSystem Core/General
Versions:13.5.0 Frequency of
Environment:Attachments:( 0) backtrace_onshutdown.txt
( 1) backtrace_onstartup_2.txt
( 2) backtrace_onstartup.txt
( 3) coreshowsettings.txt
( 4) onstartup_full_2.txt
( 5) onstartup_full.txt
( 6) onstartup_messages_2.txt
( 7) onstartup_messages.txt
( 8) onstartup_shell_output.txt
Description:I am trying to investigate a possible memory leak issue with release 13.5.0. In order to have better information I enabled MALLOC_DEBUG on menuselect compiler flags.
After compiling the machine and restarting It dosn't come up. I get the following errors every couple of seconds on the log:
[Sep  9 16:31:20] Asterisk 13.5.0 built by root @ vm-tclabr-y.bgtehila.com on a x86_64 running Linux on 2015-09-09 13:16:12 UTC
Comments:By: Asterisk Team (asteriskteam) 2015-09-09 08:35:12.839-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Rusty Newton (rnewton) 2015-09-14 18:17:15.356-0500

I can't reproduce this issue with MALLOC_DEBUG.

Compiling with MALLOC_DEBUG, Asterisk starts as expected and performs normally with a minimal or sample configuration.

Can you try to reproduce this with completely sample configuration?

Did you enable/disable any other menuselect options aside from the default option states?

Did you try with a fresh tarball?

Can you try with the Git branch head of 11?

By: Rusty Newton (rnewton) 2015-09-15 09:15:52.327-0500

Oh I think I may have reproduced it.  All of the questions are still helpful though. We'll see in a minute what I come up with.

By: Rusty Newton (rnewton) 2015-09-15 09:58:01.679-0500

Enabling MALLOC_DEBUG results in unreliable Asterisk behavior including a couple segmentation fault scenarios.

Attaching several traces and logs.

Two traces and log sets from when it crashes and dumps on startup. One trace from when it actually started up successfully and then dumped after "core stop now". I didn't get a log to go with the shutdown dump.

Other than crashing on startup and sometimes running, then dumping on shutdown, Asterisk also occasionally freezes during startup with

Loading res_stasis.so.
 == Message handler 'ari' registered.
 == res_stasis.so => (Stasis application support)
Loading res_stasis_answer.so.
 == res_stasis_answer.so => (Stasis application answer support)
*** glibc detected *** asterisk: corrupted double-linked list: 0x0000000001f1b1f0 ***

By: Rusty Newton (rnewton) 2015-09-15 13:34:09.847-0500

Attaching my 'core show settings' output and some output that went to stdout on the dump and not to the logs or anywhere else.

By: Richard Mudgett (rmudgett) 2015-09-29 12:31:42.962-0500

Patch up on gerrit to fix the memory  corruption:
https://gerrit.asterisk.org/1337 v13
https://gerrit.asterisk.org/1340 master