[Home]

Summary:ASTERISK-20649: Patches for memory leaks and other cleanup across several files
Reporter:Corey Farrell (coreyfarrell)Labels:
Date Opened:2012-11-04 21:23:41.000-0600Date Closed:2012-12-11 16:13:42.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Core/General
Versions:1.8.17.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) ccss-cleanup-all.patch
( 1) cdr-cleanup-1_8.patch
( 2) cdr-cleanup-10-11-trunk.patch
( 3) cli-leaks-1_8-10.patch
( 4) cli-leaks-11-trunk.patch
( 5) config-cleanup-all.patch
( 6) core-cleanup-1_8-10.patch
( 7) core-cleanup-11-trunk.patch
( 8) db-cleanup-1_8-only.patch
( 9) dnsmgr-cleanup-1_8.patch
(10) dnsmgr-cleanup-10-11-trunk.patch
(11) event_shutdown-1_8-11-trunk.patch
(12) event_shutdown-10-only.patch
(13) frame-cleanup-1_8-only.patch
(14) indications-cleanup-all.patch
(15) logger-cleanup-all.patch
(16) pbx-cleanup-1_8.patch
(17) pbx-cleanup-10.patch
(18) pbx-cleanup-11-trunk.patch
(19) ssl_shutdown-1_8-10.patch
(20) taskprocessor-cleanup-1_8-11-trunk.patch
(21) taskprocessor-cleanup-10-only.patch
(22) udptl-shutdown-1_8-10.patch
(23) udptl-shutdown-11-trunk.patch
(24) unregister-cli-multiple-all.patch
Description:Valgrind reports memory still allocated at exit.  Patches will follow to address many of these issues against branch 1.8.

||Source||Issues||
|many|CLI commands not unregistered|
|ccss.c|Logger level not unregistered|
|cdr.c|No cleanup at exit|
|cli.c|Command registration leaks memory on some error's|
|config.c|Config cache not cleared|
|db.c|No cleanup at exit|
|dnsmgr.c|No cleanup at exit|
|indications.c|Sounds leaked when removed from zone
Ringcadence allocated twice causing leak
Shutdown incomplete|
|logger.c|close_logger incomplete|
|pbx.c|device_state_tps, hints and statecbs keep references|
|ssl.c|No cleanup at exit|
|asterisk.c|ast_run_atexits doesn't cleanup atexits list
Shutdown from cli causes ast_cli_entry to be inuse
Verbose runs ast_active_channels() after channels_shutdown|
|stdtime/localtime.c|No cleanup.  Cleanup needs to be done after logger cleanup|
Comments:By: Corey Farrell (coreyfarrell) 2012-11-04 21:34:27.025-0600

Patches are for an individual source file except:
* unregister-cli-multiple.patch has fixes to all sources that did nothing more than fail to unregister cli commands
* core-cleanup takes care of issues in asterisk.c and stdtime/localtime.c.  This also adds void clean_zones(void) to asterisk/_private.h.

Most things done should be self explanatory.  If anything isn't let me know.

In indications.c I moved ao2_unlink(ast_tone_zones, tz) higher in the procedure to make it impossible for the same tone zone to be reselected as default_tone_zone.

By: Corey Farrell (coreyfarrell) 2012-11-05 17:53:24.261-0600

Replacement patches coming shortly to fix naming issues with new procedures.

By: Corey Farrell (coreyfarrell) 2012-11-10 15:37:42.556-0600

Corrected patches using [source_name]_shutdown for exit procedures.  Patches were checked against 1.8/10/11/trunk.  This does not resolve all shutdown's.

* I'm not sure how the patch for ssl shutdown applies to 11 or trunk.  I haven't had a chance to figure out libasteriskssl.
* These patches only address issues found in 1.8.
* event and taskprocessor for branch 10 have additional fixes, the shutdown for these sources was somehow not applied to version 10.
* I haven't touched features.c yet.
* Enabling DEBUG_THREADS produces a huge number of memory leaks due to locks not being destroyed.

By: Richard Mudgett (rmudgett) 2012-12-03 14:50:46.456-0600

Committed the following patches:
ccss-cleanup-all.patch
cdr-cleanup-10-11-trunk.patch
cdr-cleanup-1_8.patch
cli-leaks-11-trunk.patch
cli-leaks-1_8-10.patch
config-cleanup-all.patch
core-cleanup-11-trunk.patch
core-cleanup-1_8-10.patch


By: Richard Mudgett (rmudgett) 2012-12-10 20:47:29.384-0600

Committed the following patches:
db-cleanup-1_8-only.patch
dnsmgr-cleanup-10-11-trunk.patch
dnsmgr-cleanup-1_8.patch
event_shutdown-10-only.patch
event_shutdown-1_8-11-trunk.patch
frame-cleanup-1_8-only.patch
indications-cleanup-all.patch
logger-cleanup-all.patch


By: Richard Mudgett (rmudgett) 2012-12-11 16:06:10.332-0600

Committed the following patches:
pbx-cleanup-10.patch
pbx-cleanup-11-trunk.patch
pbx-cleanup-1_8.patch
taskprocessor-cleanup-10-only.patch
taskprocessor-cleanup-1_8-11-trunk.patch
udptl-shutdown-11-trunk.patch
udptl-shutdown-1_8-10.patch
unregister-cli-multiple-all.patch

I am not committing this patch:
ssl_shutdown-1_8-10.patch

I am not that familiar with the SSL library.  The patch won't compile on my system.  The SSL library has been touchy with memory issues lately.

By: Richard Mudgett (rmudgett) 2012-12-11 16:13:42.146-0600

All but the ssl_shutdown-1_8-10.patch committed.