summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51a4e62)
raw | patch | inline | side by side (parent: 51a4e62)
author | Yoga Ramalingam <yramalingam1@bloomberg.net> | |
Wed, 12 Nov 2014 21:07:15 +0000 (16:07 -0500) | ||
committer | Yoga Ramalingam <yramalingam1@bloomberg.net> | |
Fri, 28 Nov 2014 21:03:52 +0000 (16:03 -0500) |
Summary:
Problem: collectdctl command hangs on AIX and returns error 0 on Solaris.
Root cause - client (collectdctl) and server (collectd daemon) are using fprintf to communicate using Unix domain socket, Since fprintf buffers, command sent by client did not reach server, since client does not get the response, it closes the socket which forces the client to flush the command, now server receives the command, when responding, it gets socket error because the client already closed the socket.
Solution: Added flush after all fprintf calls.
Test Plan: Tested collectdctl on AIX and SunOS for listval, getval commands
Reviewers: skhajamo
Reviewed By: skhajamo
CC: arcyd
Differential Revision: https://all.phab.dev.bloomberg.com/D155584
Problem: collectdctl command hangs on AIX and returns error 0 on Solaris.
Root cause - client (collectdctl) and server (collectd daemon) are using fprintf to communicate using Unix domain socket, Since fprintf buffers, command sent by client did not reach server, since client does not get the response, it closes the socket which forces the client to flush the command, now server receives the command, when responding, it gets socket error because the client already closed the socket.
Solution: Added flush after all fprintf calls.
Test Plan: Tested collectdctl on AIX and SunOS for listval, getval commands
Reviewers: skhajamo
Reviewed By: skhajamo
CC: arcyd
Differential Revision: https://all.phab.dev.bloomberg.com/D155584
index 726f25d424b2476f84ddaa3584d4e8f91cdf7476..49a4d8792c5c1aa991d412dd4a95dcaea4d8c8fd 100644 (file)
lcc_set_errno (c, errno);
return (-1);
}
+ fflush(c->fh);
return (0);
} /* }}} int lcc_send */
diff --git a/src/utils_cmd_flush.c b/src/utils_cmd_flush.c
index 3584f3b71a3c82bd73ec85cd55201422f8a8e1f8..c35aeb04c1b67b01f3a0cd857795f5944e1b1d44 100644 (file)
--- a/src/utils_cmd_flush.c
+++ b/src/utils_cmd_flush.c
WARNING ("handle_flush: failed to write to socket #%i: %s", \
fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
return -1; \
- }
+ } \
+ fflush(fh);
static int add_to_array (char ***array, int *array_num, char *value)
{
diff --git a/src/utils_cmd_getval.c b/src/utils_cmd_getval.c
index ce3e28e003eafc8f671dde5acab5462a5c57847f..9de66df33173c207910bc360d2987ef80735f57e 100644 (file)
--- a/src/utils_cmd_getval.c
+++ b/src/utils_cmd_getval.c
WARNING ("handle_getval: failed to write to socket #%i: %s", \
fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
return -1; \
- }
+ } \
+ fflush(fh);
int handle_getval (FILE *fh, char *buffer)
{
index ef66af56c408d8ae1ab300386875c7d57fe93189..864e5f440a002c5dc516c1932c3f555ebd819368 100644 (file)
--- a/src/utils_cmd_listval.c
+++ b/src/utils_cmd_listval.c
WARNING ("handle_listval: failed to write to socket #%i: %s", \
fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
free_everything_and_return (-1); \
- }
+ } \
+ fflush(fh);
int handle_listval (FILE *fh, char *buffer)
{
index d3cf3834dea42885ff6df3d4695b53bf38d64872..d09eeb3ee75eba0eabb554f784f287968b4239c9 100644 (file)
--- a/src/utils_cmd_putnotif.c
+++ b/src/utils_cmd_putnotif.c
WARNING ("handle_putnotif: failed to write to socket #%i: %s", \
fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
return -1; \
- }
+ } \
+ fflush(fh);
static int set_option_severity (notification_t *n, const char *value)
{
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index 4cbc2f1d96d5a2237946fa69f9c4fabad709e78c..d579b6e84e2c6c86066571aed8cd8605103060f6 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
WARNING ("handle_putval: failed to write to socket #%i: %s", \
fileno (fh), sstrerror (errno, errbuf, sizeof (errbuf))); \
return -1; \
- }
+ } \
+ fflush(fh);
static int dispatch_values (const data_set_t *ds, value_list_t *vl,
FILE *fh, char *buffer)