@cryptotaxi247 / netdata-1 / commits / e0077ca85

backport of fixes from balance-parents (#19012)

* fix replication crash on exit * fix crash on exit due to incomplete begin-set-end v2 * fix incorrect check of function in rrdhost_status()

Costa Tsaousis committed Nov 14, 2024 at 14:02 UTC e0077ca857c4345a62ed9e6813ecb28f436d3913
3 files changed +6 -1
src/streaming/receiver.c
+4
@@ -384,6 +384,10 @@ static size_t streaming_parser(struct receiver_state *rpt, struct plugind *cd, i
384 buffer->buffer[0] = '\0';
385 }
386
387 + // cleanup the sender buffer, because we may end-up reusing an incomplete buffer
388 + sender_thread_buffer_free();
389 + parser->user.v2.stream_buffer.wb = NULL;
390 +
391 // make sure send_to_plugin() will not write any data to the socket
392 spinlock_lock(&parser->writer.spinlock);
393 parser->fd_output = -1;
src/streaming/replication.c
+1
@@ -612,6 +612,7 @@ static struct replication_query *replication_response_prepare(
612 }
613
614 void replication_response_cancel_and_finalize(struct replication_query *q) {
615 + if(!q) return;
616 replication_query_finalize(NULL, q, false);
617 }
618
src/streaming/rrdhost-status.c
+1 -1
@@ -224,7 +224,7 @@ void rrdhost_status(RRDHOST *host, time_t now, RRDHOST_STATUS *s) {
224
225 if(host == localhost)
226 s->ingest.type = RRDHOST_INGEST_TYPE_LOCALHOST;
227 - else if(has_receiver || rrdhost_flag_set(host, RRDHOST_FLAG_RRDPUSH_RECEIVER_DISCONNECTED))
227 + else if(has_receiver || !rrdhost_flag_check(host, RRDHOST_FLAG_RRDPUSH_RECEIVER_DISCONNECTED))
228 s->ingest.type = RRDHOST_INGEST_TYPE_CHILD;
229 else if(rrdhost_option_check(host, RRDHOST_OPTION_VIRTUAL_HOST))
230 s->ingest.type = RRDHOST_INGEST_TYPE_VIRTUAL;