pcp
[Top] [All Lists]

Re: [pcp] pcp updates: qa, docs, icons, libpcp fix

To: Nathan Scott <nathans@xxxxxxxxxx>, pcp developers <pcp@xxxxxxxxxxx>
Subject: Re: [pcp] pcp updates: qa, docs, icons, libpcp fix
From: Mark Goodwin <mgoodwin@xxxxxxxxxx>
Date: Thu, 28 Apr 2016 09:19:16 +1000
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <1047346353.43497833.1461743562627.JavaMail.zimbra@xxxxxxxxxx>
References: <1047346353.43497833.1461743562627.JavaMail.zimbra@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1
On 04/27/2016 05:52 PM, Nathan Scott wrote:
Changes committed to git://git.pcp.io/pcp.git master
..
commit 89686243fe54572db0a5b71952e026e8784a7506
Author: Nathan Scott <nathans@xxxxxxxxxx>
Date:   Wed Apr 27 17:49:42 2016 +1000

     libpcp: fix brown paper bag pmcd-context-sharing bug

     Rewrote test qa/246 (has had some problems since adding global
     derived metrics support) to use valgrind instead of doing leak
     detection "by-hand" using malloc pointer range checks.

     This immediately showed a memory leak between pmNewContext and
     pmDestroyContext, via the c_pmcd pointer when a few contexts are
     in play.  Turns out to be due to a failure to perform reference
     counting correctly, which in turn was due to a missing "break"
     statement in the loop seeking a PMCD context sharing match.  It
     is nasty not only because of the incorrect refcnts and leaks, but
     because it basically disables sharing for the case of different
     host contexts (only when the final context in the context array
     happens to be a match would sharing actually happen correctly).


I reviewed the changes to context.c, looks good - taking an extra ref
like that for (potentially) all contexts could be a pretty hairy leak
and I'm surprised we've not noticed it before.

I think you can also break out of the inner loop once we've detected
that the ports are not the same, as in the attached patch.

Regards

Attachment: libpcp_newcontext_extra.patch
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>