Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix issue #430 where write_graphite fails to reconnect #502

Merged
merged 1 commit into from

3 participants

@rtkmhart

If LogSendErrors is set to false and protocol is tcp, the socket file descriptor was not getting reset to -1, and thus the tcp connection is never re-established if the remote end goes away. This pull requests fixes that problem, as described in issue #430

@cwimmer

+1

I hit this bug on a daily basis. I've had to hack a script that restarts collectd periodically in order to keep the metrics flowing.

@pyr
Collaborator

thanks for the catch

@pyr pyr merged commit 4c6303e into collectd:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 20, 2013
  1. @rtkmhart
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/write_graphite.c
View
14 src/write_graphite.c
@@ -128,13 +128,15 @@ static int wg_send_buffer (struct wg_callback *cb)
ssize_t status = 0;
status = swrite (cb->sock_fd, cb->send_buf, strlen (cb->send_buf));
- if (cb->log_send_errors && status < 0)
+ if (status < 0)
{
- char errbuf[1024];
- ERROR ("write_graphite plugin: send to %s:%s (%s) failed with status %zi (%s)",
- cb->node, cb->service, cb->protocol,
- status, sstrerror (errno, errbuf, sizeof (errbuf)));
-
+ if (cb->log_send_errors)
+ {
+ char errbuf[1024];
+ ERROR ("write_graphite plugin: send to %s:%s (%s) failed with status %zi (%s)",
+ cb->node, cb->service, cb->protocol,
+ status, sstrerror (errno, errbuf, sizeof (errbuf)));
+ }
close (cb->sock_fd);
cb->sock_fd = -1;
Something went wrong with that request. Please try again.