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: Fri, 22 Jan 2016 20:56:27 +1100
Cc: "'pcp developers'" <pcp@xxxxxxxxxxx>
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <002a01d154f5$a7ec0a80$f7c41f80$@internode.on.net>
References: <569CB025.4070603@xxxxxxxxxx> <569CB7C5.7030803@xxxxxxxxxxxxxxxx> <1305297915.11201184.1453261568406.JavaMail.zimbra@xxxxxxxxxx> <006201d153e5$03a61fd0$0af25f70$@internode.on.net> <1320206202.12543073.1453421036522.JavaMail.zimbra@xxxxxxxxxx> <002a01d154f5$a7ec0a80$f7c41f80$@internode.on.net>
Thread-index: AQIHi+15HIXLtpebrkfAOJtsaFEj0AIkYFWzAnUHQ94BqJQe9gJHRgBlANyg9P2eT6wZQA==
> -----Original Message-----
> From: pcp-bounces@xxxxxxxxxxx [mailto:pcp-bounces@xxxxxxxxxxx] On
> Behalf Of Ken McDonell
> Sent: Friday, 22 January 2016 8:17 PM
> To: 'Nathan Scott' <nathans@xxxxxxxxxx>
> Cc: 'pcp developers' <pcp@xxxxxxxxxxx>
> Subject: Re: [pcp] pmRegisterDerived return values
> ... 
> Just by the way, we use thread private data in other places ... are
> these potential hand grenades waiting for a Python detonator?

I've been think about this ... the problem is even larger than thread
private data.  We have some routines in libpcp that are NOT thread safe
because they call underlying kernel/run-time routines that are not
thread-safe.  And we explicitly check to see if they are ever called from
more than a single thread.

This is a BIG problem ...

kenj@bozo-vm:~/src/pcp/src/libpcp/src$ grep PM_MULTIPLE_THREADS *.c | wc -l
40

If the Python run-time is choosing different threads to enter libpcp at
different points in time, this will blow up.

But, wait, it gets worse ... libpcp_pmda is not thread safe and never has
been (there is no need for multiple threads on the pmcd-pmda-pmcd code path
for PMDAs implemented in conventional programming languages), so goodness
knows what evil is lurking below the Python wrapper for libpcp_pmda.

And as for thread private data, we have plenty of them in libpcp ...

kenj@bozo-vm:~/src/pcp/src/libpcp/src$ grep TPD *.c | wc -l
67

This seems like a class of problems that needs to be solved by stopping the
Python run-time from launching multiple threads between the Python code and
the PCP libraries, not band-aiding in the PCP libraries.


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