pcp
[Top] [All Lists]

Re: [pcp] pmRegisterDerived return values

To: Nathan Scott <nathans@xxxxxxxxxx>
Subject: Re: [pcp] pmRegisterDerived return values
From: Ken McDonell <kenj@xxxxxxxxxxxxxxxx>
Date: Sun, 24 Jan 2016 22:16:04 +1100
Cc: Marko Myllynen <myllynen@xxxxxxxxxx>, pcp developers <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <587895039.13498181.1453615697410.JavaMail.zimbra@xxxxxxxxxx>
References: <569CB025.4070603@xxxxxxxxxx> <569CB7C5.7030803@xxxxxxxxxxxxxxxx> <1305297915.11201184.1453261568406.JavaMail.zimbra@xxxxxxxxxx> <007401d155a4$fd1e1660$f75a4320$@internode.on.net> <587895039.13498181.1453615697410.JavaMail.zimbra@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1
On 24/01/16 17:08, Nathan Scott wrote:
Hi Ken,
...
The threading aspect is certainly a red herring - at the time it seemed the
only plausible explanation for pmDerivedErrStr returning NULL directly after
a failed pmRegisterDerived call.  But as I should have realised, since the
second scenario in the qa/803 case actually triggers it (!), there are cases
where this NULL pointer is expected.

I've updated the commit - I think the fix remains sound (as the QA proved),
despite the earlier theory being incorrect.  We could alternatively fix this
in python wrapper code (awkwardly), but providing a libpcp API with the more
convenient error handling properties still seems the better option to me.
I also updated pmDerivedErrStr(3) to document the NULL behaviour, and to add
mention of both higher level register APIs.

How does this look?  ...

I don't like changes for the libpcp APIs that aim to fix problems we don't fully understand.

...
     This handles the case where pmRegisterDerived fails but pmDerivedErrStr
     still returns NULL.  Makes life easier for high-level code like python
     wanting to access the derived metrics parser diagnostics.

From the original design point, this is just wrong.

I'd like to revisit pmRegisterDerived() and understand why it fails without setting an error for pmDerivedErrStr() to return.

Unfortunately I won't be able to do this before Tue, or may be Wed, which is very late in the release cycle.

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