collectdctl command hangs on AIX and returns error 0 on Solaris.
authorYoga Ramalingam <yramalingam1@bloomberg.net>
Wed, 12 Nov 2014 21:07:15 +0000 (16:07 -0500)
committerYoga Ramalingam <yramalingam1@bloomberg.net>
Fri, 28 Nov 2014 21:03:52 +0000 (16:03 -0500)
commit993900f43c19c3836a6a4e89268ffb6d17d0fce0
tree54103e105e014f4bf177695104b58f4f961341d9
parent51a4e62d7d0e73d8d5822efaef1e3218b5ad0373
collectdctl command hangs on AIX and returns error 0 on Solaris.

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
src/libcollectdclient/client.c
src/utils_cmd_flush.c
src/utils_cmd_getval.c
src/utils_cmd_listval.c
src/utils_cmd_putnotif.c
src/utils_cmd_putval.c