pcp
[Top] [All Lists]

Bug fix: fix python PMDA support when returning fetch callback errors

To: pcp <pcp@xxxxxxxxxxx>
Subject: Bug fix: fix python PMDA support when returning fetch callback errors
From: David Smith <dsmith@xxxxxxxxxx>
Date: Tue, 19 May 2015 15:43:10 -0500
Delivered-to: pcp@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
While working on the JSON PMDA, I found a bug where I got a SIGSEGV in
python if I accidentally returned an int value for a string metric.
After working on this for a couple of days, I figured out that if you
returned a positive integer, that number got put into the atom->cp field
and then __pmStuffValue() tried to use that positive integer as a
pointer value in a memcpy() call. Boom.

I thought I fixed that problem, but I was still getting a SIGSEGV, but
later in my code. I finally tracked that down to an unhandled error
getting created when PyArg_Parse() fails. This error occurs when just
returning an error code for a string metric.

So, here's a patch that fixes the above problems for me and seems to
work well. It is commit ec3eda6 on the dsmith/dev branch of pcpfans.git
or at the following link:

<https://www.sourceware.org/git/gitweb.cgi?p=pcpfans.git;a=commitdiff;h=refs/heads/dsmith/dev;hp=27976c5bd80b65a076b3a8f444ffb17b11d0af25>

-- 
David Smith
dsmith@xxxxxxxxxx
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)

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