summaryrefslogtreecommitdiffstats
path: root/streaming
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2020-06-22 18:19:31 +0000
committerGitHub <noreply@github.com>2020-06-22 20:19:31 +0200
commitbedb2eea3ee19142f62818fdcca71cba04e2adc5 (patch)
treea09abaa57994808325e799fce72dcf196bd7a43a /streaming
parent289fb07015c42f676b4b662500827cd38549ff4c (diff)
Fixed concurrency bug in health sending HOST VARIABLE to receiver (#9396)
The recent changes to the streaming component wipe the send buffer when the mutex is acquired to prevent stale data and expose concurrency bugs. The callback from health was called from another thread to write into the stream buffer without any protection. This protects the access to the buffer.
Diffstat (limited to 'streaming')
-rw-r--r--streaming/sender.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/streaming/sender.c b/streaming/sender.c
index c603503051..4a41d6acc7 100644
--- a/streaming/sender.c
+++ b/streaming/sender.c
@@ -70,8 +70,10 @@ static int rrdpush_sender_thread_custom_host_variables_callback(void *rrdvar_ptr
}
static void rrdpush_sender_thread_send_custom_host_variables(RRDHOST *host) {
+ sender_start(host->sender);
int ret = rrdvar_callback_for_all_host_variables(host, rrdpush_sender_thread_custom_host_variables_callback, host);
(void)ret;
+ sender_commit(host->sender);
debug(D_STREAM, "RRDVAR sent %d VARIABLES", ret);
}