[collectd] curl Plugin holds connections open

Dan Fandrich dan at coneharvesters.com
Fri Nov 14 09:16:39 CET 2014


On Thu, Nov 13, 2014 at 03:19:17PM -0800, Mark Juric wrote:
> Hello all,
> I have an issue with the curl plugin. I'm collecting at 60 second intervals
> from a web page on localhost, and it appears the connection is being held open
> in between queries. For most situations this is okay, but I have a large
> application installation that runs a "reaper" process to kill stuck Apache
> threads. If I'm connected to a stuck thread that gets reaped, my connection
> remains open and all future collections fail. The only solution is to
> completely restart collectd.
> 
> Is this a configurable option? The overhead of a new server connection every 60
> seconds is negligible in my application, but the implications of losing data
> collection even though the demon continues to run are troubling.

libcurl provides a way to accomplish this (the CURLOPT_FORBID_REUSE option) but
it's not exposed by collectd. However, this shouldn't be necessary; libcurl
will detect when a socket is closed and automatically open a new connection in
that case. If the socket isn't actually closed, it's a different story. One of
the timeout options or the TCP keepalive option should be enabled to catch that
situation, but neither of those are exposed by collectd, either.

>>> Dan



More information about the collectd mailing list