pcp
[Top] [All Lists]

Re: Couple of small PCP python API issues

To: Stan Cox <scox@xxxxxxxxxx>
Subject: Re: Couple of small PCP python API issues
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Mon, 24 Sep 2012 23:35:56 -0400 (EDT)
Cc: pcp@xxxxxxxxxxx
In-reply-to: <1706033060.134528.1348399692042.JavaMail.root@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>

----- Original Message -----
> ...
> - about the pmContext global locking - I think this can all be
> safely removed now that the pmapi C routines all have locking?
> Pretty sure there's at least one deadlock there too (pmprintf()
> wrapper holds that lock for an awfully long time - if any other
> python calls come in before the flush = deadlock?).  My vote is
> for complete removal, and reliance on the C code locking (seems
> silly to double up anyway - I suspect the python locks predate
> the libpcp locking, so nowadays its not needed).

Just noticed also that some error paths in pmRecordSetup() and
pmRecordAddHost() fail to release the lock.  But, not a problem
if the lock is removed. :)  These routines didn't actually need
a lock in the first place, afaict, as they don't use contexts.

Another simplification - we should also remove _lastUsedContext,
and simply call libpcp.pmUseContext whenever a call is going to
be made that will use a host/archive context (using self.ctx).
Switching contexts is lightweight, its not worth all that extra
python code to avoid calling pmUseContext.

cheers.

--
Nathan

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