From: Przemyslaw Szczerbik Date: Tue, 3 Jan 2017 13:46:04 +0000 (+0000) Subject: mcelog: Increase delay between socket reinitialization X-Git-Tag: collectd-5.8.0~239^2~5 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3679e44b3611544270bcbd9e2d3aaf55e4dc5f02;p=collectd.git mcelog: Increase delay between socket reinitialization Change delay between subsequent socket reinitialization attempts from 1000 usec to 1000 ms. Such frequent attempts were affecting collectd functionality and flooded the syslog. Issue can be eaisly reproduced by stopping mcelog service while collectd with mcelog plugin enabled is running. Signed-off-by: Przemyslaw Szczerbik --- diff --git a/src/mcelog.c b/src/mcelog.c index 6dbfafce..7299d117 100644 --- a/src/mcelog.c +++ b/src/mcelog.c @@ -416,14 +416,13 @@ static void *poll_worker(__attribute__((unused)) void *arg) { pthread_cleanup_push(poll_worker_cleanup, pp_file); while (1) { - int res = 0; /* blocking call */ - res = socket_adapter.receive(&socket_adapter, pp_file); + int res = socket_adapter.receive(&socket_adapter, pp_file); if (res < 0) { socket_adapter.close(&socket_adapter); - if (socket_adapter.reinit(&socket_adapter) != 0) { - socket_adapter.close(&socket_adapter); - usleep(MCELOG_POLL_TIMEOUT); + while (socket_adapter.reinit(&socket_adapter) != 0) { + nanosleep(&CDTIME_T_TO_TIMESPEC(MS_TO_CDTIME_T(MCELOG_POLL_TIMEOUT)), + NULL); } continue; }