[Home]

Summary:ASTERISK-00592: Memory not released after off hook/on hook transition by mgcp endpoint.
Reporter:darrenm67 (darrenm67)Labels:
Date Opened:2003-11-28 16:56:45.000-0600Date Closed:2008-01-15 14:42:39.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_mgcp.c.diff
( 1) memstats-598.txt
Description:Using top, it looks like memory is not released after off hook/on hook transition by mgcp endpoint. Eventually leads due to callp failure with message File chan_mgcp.c, Line 2127 = (handle_hd_hf): Unable to create switch thread: Interrupted system call

****** ADDITIONAL INFORMATION ******

evident in v1.29 of chan_mgcp.c
Comments:By: Brian West (bkw918) 2003-12-10 23:56:02.000-0600

Has this been fixed yet?

By: darrenm67 (darrenm67) 2003-12-11 17:59:57.000-0600

I am happy to collect data and run debugging if someone identifies what data and debugging info is required.

By: Brian West (bkw918) 2003-12-12 13:51:02.000-0600

# Uncomment next one to enable malloc debugging
# You can view malloc debugging with:
#   *CLI> show memory allocations [filename]
#   *CLI> show memory summary [filename]
#
MALLOC_DEBUG = #-include $(PWD)/include/asterisk/astmm.h

In asterisk/Makefile

By: darrenm67 (darrenm67) 2003-12-14 14:58:17.000-0600

Attached file has above debugging and valgrind data.

By: klasstek (klasstek) 2003-12-17 11:22:44.000-0600

There's actually a little more than 300 bytes less in chan_mgcp at the last show memory summary than there was at the beginning summary.  I'm not saying that chan_mgcp is perfectly clean but it doesn't appear to be showing significant increases with the hu hd transitions.

By: sergi (sergi) 2003-12-30 04:28:43.000-0600

I found the reason why this situation happens.
I see in chan_mgcp.c that on every onhook/offhook transition there is phtread_create call in handle_hd_hf function.
The pthread_create creates thread with default attributes which means that created thread is joinable and it means that upon exiting thread does not free resources. I changed thread creation attribute to PTHREAD_CREATE_DETACHED and above problem has been solved. Also, Mentioned attribute I assigned to monitor thread in chan_mgcp.c in funcrion restart_monitor.

By: philipp2 (philipp2) 2003-12-30 07:18:07.000-0600

Excuse my ignorance: Does that mean that "monitor" (call recording) also works for MGCP channels, not only for ZAP channels? I wasn't aware of that.

By: sergi (sergi) 2004-01-05 04:41:45.000-0600

Yes, it works. I tried it succesfully.

By: jrollyson (jrollyson) 2004-01-12 00:40:24.000-0600

Is this still an issue? Can someone confirm?

By: darrenm67 (darrenm67) 2004-01-12 02:51:47.000-0600

Not in CVS, can someone post where to make the attribute change?

By: sergi (sergi) 2004-01-12 05:01:19.000-0600

I attached chan_mgcp.c.diff file.
This changes works for me.

By: darrenm67 (darrenm67) 2004-01-12 16:23:20.000-0600

I can confirm the patch works for me as well.

By: Mark Spencer (markster) 2004-02-01 18:40:24.000-0600

Applied, thanks!

By: Digium Subversion (svnbot) 2008-01-15 14:42:39.000-0600

Repository: asterisk
Revision: 2106

U   trunk/channels/chan_mgcp.c

------------------------------------------------------------------------
r2106 | markster | 2008-01-15 14:42:38 -0600 (Tue, 15 Jan 2008) | 2 lines

Use better flags when starting MGCP threads (bug ASTERISK-592)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=2106