ganglia / monitor-core

Ganglia Monitoring core
BSD 3-Clause "New" or "Revised" License
491 stars 246 forks source link

memory leak #45

Open waxie opened 12 years ago

waxie commented 12 years ago

As discussed earlier on the ganglia-developers list

Please give this a bump in priority.

Our gmond steadily increases to multiple Gigabytes memory usage

jbuchbinder commented 12 years ago

From original issue:

In gmond.c, function Ganglia_metadata_save(...) and Ganglia_value_save(...):
metric and metric->name memory is allocated from host->pool.
When gmetric data timed out and is deleted in Cleanup_data(...), metric is
removed from gmetric hash table and metric->pool is destroyed. But allocated
memory for metric and metric->name can't be released unless host->pool is
destroyed. If gmond receive same gmetric data again, metric and metric->name
alway allocate new memory. If certain gmetric data switchs from time out/active
frequently, memory usage can increase more than 40M per day.
My temporary solution is to comment out following code in Cleanup_data to avoid
allocating memory again:

//apr_hash_set( host->metrics, metric->name, APR_HASH_KEY_STRING, NULL);
//apr_hash_set( host->gmetrics, metric->name, APR_HASH_KEY_STRING, NULL);
/* destroy any memory that was allocated for this gmetric */
//apr_pool_destroy( metric->pool );

I think metric->name can be allocated from metric->pool, but metric may need a
new pool to hold.

Thanks
Wei
vvuksan commented 12 years ago

I don't think this is the right case

keyurdg commented 10 years ago

This can be closed now. @vvuksan when will a new release be out?

denji commented 9 years ago
[gmetad/export_helpers.c:373] -> [gmetad/export_helpers.c:410]: (warning) Possible null pointer dereference: host - otherwise it is redundant to check it against null.
[gmetad/export_helpers.c:375] -> [gmetad/export_helpers.c:395]: (warning) Possible null pointer dereference: source - otherwise it is redundant to check it against null.
[gmetad/export_helpers.c:377] -> [gmetad/export_helpers.c:433]: (warning) Possible null pointer dereference: metric - otherwise it is redundant to check it against null.
[gmetad/export_helpers.c:481] -> [gmetad/export_helpers.c:433]: (warning) Possible null pointer dereference: metric - otherwise it is redundant to check it against null.
[gmetad/export_helpers.c:356]: (error) Dangerous usage of 'path_cp' (strncpy doesn't always null-terminate it).
[gmetad/rrd_helpers.c:373]: (error) Dangerous usage of 'rrd' (strncpy doesn't always null-terminate it).
[gmetad/server.c:236] -> [gmetad/server.c:244]: (performance) Variable 'rc' is reassigned a value before the old one has been used.
[gmetad/server.c:253] -> [gmetad/server.c:254]: (performance) Variable 'rc' is reassigned a value before the old one has been used.
[gmetad/server.c:254] -> [gmetad/server.c:256]: (performance) Variable 'rc' is reassigned a value before the old one has been used.
[gmetad/server.c:296] -> [gmetad/server.c:306]: (performance) Variable 'rc' is reassigned a value before the old one has been used.
[gmetad/server.c:315] -> [gmetad/server.c:316]: (performance) Variable 'rc' is reassigned a value before the old one has been used.
[gmetad/server.c:316] -> [gmetad/server.c:319]: (performance) Variable 'rc' is reassigned a value before the old one has been used.
[gmetad/server.c:419] -> [gmetad/server.c:422]: (performance) Variable 'rc' is reassigned a value before the old one has been used.
[gmond/g25_config.c:363]: (error) Resource leak: fp
[gmond/g25_config.c:371]: (error) Resource leak: fp
[gmond/g25_config.c:376]: (error) Resource leak: fp
[gmond/gmond.c:1024] -> [gmond/gmond.c:1029]: (warning) Possible null pointer dereference: buff - otherwise it is redundant to check it against null.
[gmond/gmond.c:1332] -> [gmond/gmond.c:1347]: (warning) Possible null pointer dereference: message - otherwise it is redundant to check it against null.
[gmond/gmond.c:1334] -> [gmond/gmond.c:1347]: (warning) Possible null pointer dereference: message - otherwise it is redundant to check it against null.
[gmond/gmond.c:1487] -> [gmond/gmond.c:1492]: (performance) Variable 'status' is reassigned a value before the old one has been used.
[gmond/gmond.c:1492] -> [gmond/gmond.c:1495]: (performance) Variable 'status' is reassigned a value before the old one has been used.
[gmond/modules/status/mod_gstatus.c:129]: (error) Uninitialized variable: val
[gmetad/process_xml.c:688]: (error) Uninitialized variable: host
[gstat/cmdline.c:388] -> [gstat/cmdline.c:403]: (warning) Possible null pointer dereference: field_given - otherwise it is redundant to check it against null.
[gmond/sflow.c:234]: (error) Array 'SFLOWGMetricTable[1]' accessed at index 165, which is out of bounds.
[gmond/sflow.c:253]: (error) Array 'SFLOWGMetricTable[1]' accessed at index 153, which is out of bounds.
[gmond/sflow.c:272]: (error) Array 'SFLOWGMetricTable[1]' accessed at index 10, which is out of bounds.
[gmond/sflow.c:291]: (error) Array 'SFLOWGMetricTable[1]' accessed at index 167, which is out of bounds.
[gmond/sflow.c:310]: (error) Array 'SFLOWGMetricTable[1]' accessed at index 157, which is out of bounds.
[lib/dotconf.c:211]: (warning) %ld in format string (no. 2) requires 'long' but the argument type is 'unsigned long'.
[lib/dotconf.c:304]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'unsigned long'.
[lib/ganglia.c:165]: (error) Memory leak: e2
[lib/dotconf.c:363]: (error) Memory leak: here_doc
[lib/libgmond.c:833]: (error) Memory leak: path
[lib/libgmond.c:849]: (error) Memory leak: path
[lib/readdir.c:103]: (error) Memory leak: dp
[lib/update_pidfile.c:42]: (error) Resource leak: file
[libmetrics/cygwin/metrics.c:57]: (error) Common realloc mistake: 'iftable' nulled but not freed upon failure
[libmetrics/darwin/metrics.c:1022]: (error) Common realloc mistake: 'seen' nulled but not freed upon failure
[libmetrics/darwin/metrics.c:1023]: (error) Common realloc mistake: 'lastcount' nulled but not freed upon failure
[libmetrics/darwin/metrics.c:1295]: (error) Memory leak: listptr
[libmetrics/darwin/metrics.c:266]: (error) Uninitialized variable: val
[libmetrics/darwin/metrics.c:302]: (error) Uninitialized variable: val
[libmetrics/darwin/metrics.c:338]: (error) Uninitialized variable: val
[libmetrics/darwin/metrics.c:374]: (error) Uninitialized variable: val
[libmetrics/darwin/metrics.c:410]: (error) Uninitialized variable: val
[libmetrics/dragonfly/metrics.c:1012]: (error) Common realloc mistake: 'seen' nulled but not freed upon failure
[libmetrics/dragonfly/metrics.c:1013]: (error) Common realloc mistake: 'lastcount' nulled but not freed upon failure
[libmetrics/dragonfly/metrics.c:248]: (error) Uninitialized variable: val
[libmetrics/dragonfly/metrics.c:261]: (error) Uninitialized variable: val
[libmetrics/dragonfly/metrics.c:274]: (error) Uninitialized variable: val
[libmetrics/freebsd/metrics.c:1198]: (error) Common realloc mistake: 'seen' nulled but not freed upon failure
[libmetrics/freebsd/metrics.c:1199]: (error) Common realloc mistake: 'lastcount' nulled but not freed upon failure
[libmetrics/freebsd/metrics.c:311]: (error) Uninitialized variable: val
[libmetrics/freebsd/metrics.c:324]: (error) Uninitialized variable: val
[libmetrics/freebsd/metrics.c:337]: (error) Uninitialized variable: val
[libmetrics/interface.c:18]: (error) Common realloc mistake: 'ifTable' nulled but not freed upon failure
[libmetrics/mingw/metrics.c:65]: (error) Common realloc mistake: 'iftable' nulled but not freed upon failure
[libmetrics/mingw/metrics.c:94]: (error) Uninitialized variable: timebuffer
[libmetrics/netbsd/metrics.c:1018] -> [libmetrics/netbsd/metrics.c:1019]: (performance) Variable 'i' is reassigned a value before the old one has been used.
[libmetrics/openbsd/metrics.c:839] -> [libmetrics/openbsd/metrics.c:840]: (performance) Variable 'i' is reassigned a value before the old one has been used.
[libmetrics/netbsd/metrics.c:1171]: (error) Common realloc mistake: 'seen' nulled but not freed upon failure
[libmetrics/netbsd/metrics.c:1172]: (error) Common realloc mistake: 'lastcount' nulled but not freed upon failure
[libmetrics/linux/metrics.c:628]: (error) Uninitialized variable: val
[libmetrics/openbsd/metrics.c:992]: (error) Common realloc mistake: 'seen' nulled but not freed upon failure
[libmetrics/openbsd/metrics.c:993]: (error) Common realloc mistake: 'lastcount' nulled but not freed upon failure
[libmetrics/solaris/metrics.c:1270] -> [libmetrics/solaris/metrics.c:1279]: (performance) Variable 'pct' is reassigned a value before the old one has been used.