Bug 174315

Summary: Memory leak in nanny.c
Product: Red Hat Enterprise Linux 4 Reporter: Florin Malita <fmalita>
Component: piranhaAssignee: Stanko Kupcevic <kupcevic>
Status: CLOSED ERRATA QA Contact: Corey Marthaler <cmarthal>
Severity: high Docs Contact:
Priority: medium    
Version: 4.0CC: cluster-maint, mikem
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2006-0255 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-09 19:44:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 172895    
Attachments:
Description Flags
Fix for the nanny memory leak. none

Description Florin Malita 2005-11-27 18:59:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4

Description of problem:
When using an external send program (-e), nanny fails to deallocate the result buffer and leaks memory upon every external invocation.



Version-Release number of selected component (if applicable):
piranha-0.7.0 through piranha-0.8.1

How reproducible:
Always

Steps to Reproduce:
1. start a nanny instance with a verbose external check program executed often (1s):

nanny -c -h 192.168.0.0 -p 1234 -e /sbin/lspci -x BLAH -q -t 1 --lvs&

2. watch the process memory footprint

watch -n1 "cat /proc/$(PID)/status"
  

Actual Results:  The memory footprint continues to grow indefinitely.

Expected Results:  The memory footprint should stabilize.

Additional info:

The actual leak is in nanny.c::external_check() which fails to deallocate the "result" buffer allocated by getExecOutput() using strdup:

        result = getExecOutput (flags, argv, timeout);

        if (expect_str != NULL) {
                if (strcmp (expect_str, result) != 0) {
                        piranha_log (flags, (char *)
                                     "Trouble. Recieved results are not what we 
expected from (%s)\n",
                                     inet_ntoa (*remoteAddr));
                        return 1;
                } else {
                        return 0;
                }

        }

A patch will be available shortly.

Comment 1 Florin Malita 2005-11-27 19:04:51 UTC
Created attachment 121522 [details]
Fix for the nanny memory leak.

Comment 2 Lon Hohberger 2005-11-28 14:39:50 UTC
Patch looks correct.

Comment 6 Red Hat Bugzilla 2006-03-09 19:44:37 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0255.html