@cryptotaxi247 / netdata-1 / commits / bedb2eea3

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.

thiagoftsm committed Jun 22, 2020 at 18:19 UTC bedb2eea3ee19142f62818fdcca71cba04e2adc5
1 file changed +2
streaming/sender.c
+2
@@ -70,8 +70,10 @@ static int rrdpush_sender_thread_custom_host_variables_callback(void *rrdvar_ptr
70 }
71
72 static void rrdpush_sender_thread_send_custom_host_variables(RRDHOST *host) {
73 + sender_start(host->sender);
74 int ret = rrdvar_callback_for_all_host_variables(host, rrdpush_sender_thread_custom_host_variables_callback, host);
75 (void)ret;
76 + sender_commit(host->sender);
77
78 debug(D_STREAM, "RRDVAR sent %d VARIABLES", ret);
79 }