The pmdaCache() functions read and write instance domain info
to files in $PCP_VAR_DIR/config/pmda/* but I can't see any mutex
between processes - I think it has checks for threaded apps,
but separate processes could interfere with each other, e.g. two
local context apps concurrently interleaving cache load and save
operations. Do we need some kind of flock() protection here?
Also, non-root users and users not in group 'pcp' can't write
to these files when using a local context. Is that a problem?
In addition - these functions may not be container safe. AIUI we
switch namespaces temporarily but only to those name space(s)
required for the metrics involved. e.g. fetching network metrics
will use the net namespace for the named container ID, but the
mnt namespace is not switched. Is that correct Nathan? If so,
the pmda refresh functions will save container specific instance
domain info to the host's pmda cache files, which may then be
completely wrong for the next app that loads that cache for
the host or perhaps for a different container.
Maybe we need to add the container id to each entry in each pmda
cache? Would that work?
This needs more investigation and discussion. See also:
http://oss.sgi.com/bugzilla/show_bug.cgi?id=1106
Cheers
-- Mark
|