-------- Original Message --------
Hi Nathan,
As of commit e110b05e44b0678d9ba632ab5896ccc7e50c3cf6 (pcpfans
brolley/nssmerge), I am down to two differences in the qa test results
when running with NSS/NSPR enabled as opposed to without.
They are:
387 -- pmnsunload: memory leak in NSPR found by valgrind
As we have discussed, this is memory being allocated by PR_Socket (from
within __pmCreateSocket). It is memory within NSPR's file descriptor
cache which is used by NSPR to recycle old file descriptors. This would
likely be solved by a call to PR_Cleanup, but the question is, from
where? We call PR_Init from within __pmCreateSocket, as needed (modern
versions of NSPR are self initializing on the first API call). Any
program which calls __pmCreateSocket would need to eventually call
PR_Cleanup before exiting in order to be leak-free, according to
valgrind. It may be a bit pedantic to explicitly clean up just before
exiting, but we could provide a __pmCleanup function which programs
could call before exiting. With NSS/NSPR enabled, it would call
PR_Cleanup and it would do nothing otherwise. I supposed there is the
possibility that libpcp could need a cleanup function for non-NSS/NSPR
purposes someday.
578 -- test harness expects monotonically increasing fd numbers
The openfds metric of pmcd is a bit misleading. It implies the number of
currently open file descriptors, but it is reported based on the value
of pmcd_hi_openfds (src/pmcd/src/pmcd.h) which is actually a high water
mark of the highest ever open fd number. It is perhaps coincidentally
true that native fd numbers are monotonically increasing and that, after
installation, the number of open file descriptors is also the number of
the highest fd number as the test expects. However, with NSS/NSPR
enabled, while the native fd numbers are still in the range 0-1023, the
NSPR ones are in the range 1024-2047 and so this assumption is no longer
true.
I'm thinking that we should fix the metric to actually count the number
of open fds (in the IPC table?). Can you see another solution?
Dave