Changes committed to git://oss.sgi.com/pcp/pcp.git dev
src/libpcp_http/src/http_fetcher.c | 2 +-
src/pmdas/apache/apache.c | 21 ++++++++++++++-------
2 files changed, 15 insertions(+), 8 deletions(-)
commit 2d0560735f1d0d792a67028d15ce0dbdc0c01c03
Author: Nathan Scott <nathans@xxxxxxxxxx>
Date: Thu Feb 7 14:33:59 2013 +1100
Improve pmdaapache fetch handling
Ryan reported and fixed a pmdaapache fd leak. He also noticed
that one descriptor per metric was leaked on each fetch, which
suggested the http request was being performed too often.
On closer inspection, there's a fetchcallback guard which uses
time(2) to prevent multiple fetches within a second, caching
the last result. However, that means we still call time(2) on
each callback (per-metric) and in the failure case we call the
full refresh that often as well.
Added a per-fetch hook and moved the refresh logic there (with
the one-second caching guard still in place) to improve this a
little.
commit 5de27f4f83ed12cc3d68db21e6caa9c5157944a0
Author: Ryan Doyle <rdoyle@xxxxxxxxxx>
Date: Thu Feb 7 14:17:14 2013 +1100
Fix an open file descriptor leak in pmdaapache connect error paths
The libpcp_http library which performs simple http requests for PMDAs
fails to close socket file descriptors on the connect error path.
The problem was observed when the Apache PMDA was failing to show
metrics. Ended up stracing the process and saw that pam_limits was
denying any new files to be opened. Checked /proc/$pid/fd and found
~1000 sockets.
Reproduced this behaviour by stopping Apache and then attempting to
fetch all the apache metrics. Each time I'd do a fetch, the amount of
FDs would jump up by 20 each time.
Tracked it to http_fetcher.c in the makeSocket routine. Fix reviewed
by mgoodwin and nathans on #pcp.
|