diff options
author | Vladimir Kobal <vlad@prokk.net> | 2019-08-12 10:02:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-12 10:02:23 +0300 |
commit | 4e4f95411be93a83b18fc10b768263a3cd749508 (patch) | |
tree | 15b57daede512117362d81008fb6c69cd1bb3ae2 /backends | |
parent | 381553a63c5572d3dc5cbea55ffe55dd2c73efd8 (diff) |
Fix a segmentation fault in backends (#6627)
Diffstat (limited to 'backends')
-rw-r--r-- | backends/backends.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/backends/backends.c b/backends/backends.c index 15a0cb41b5..39ab677c0f 100644 --- a/backends/backends.c +++ b/backends/backends.c @@ -658,7 +658,8 @@ void *backends_main(void *ptr) { size_t count_dims_total = 0; #if ENABLE_PROMETHEUS_REMOTE_WRITE - clear_write_request(); + if(do_prometheus_remote_write) + clear_write_request(); #endif rrd_rdlock(); RRDHOST *host; @@ -1027,14 +1028,14 @@ void *backends_main(void *ptr) { #if ENABLE_PROMETHEUS_REMOTE_WRITE - if(failures) { + if(do_prometheus_remote_write && failures) { (void) buffer_on_failures; failures = 0; chart_lost_bytes = chart_buffered_bytes = get_write_request_size(); // estimated write request size chart_data_lost_events++; chart_lost_metrics = chart_buffered_metrics; - } -#else + } else +#endif if(failures > buffer_on_failures) { // too bad! we are going to lose data chart_lost_bytes += buffer_strlen(b); @@ -1044,7 +1045,6 @@ void *backends_main(void *ptr) { chart_data_lost_events++; chart_lost_metrics = chart_buffered_metrics; } -#endif /* ENABLE_PROMETHEUS_REMOTE_WRITE */ if(unlikely(netdata_exit)) break; @@ -1101,10 +1101,9 @@ cleanup: #endif #if ENABLE_PROMETHEUS_REMOTE_WRITE - if(do_prometheus_remote_write) { - buffer_free(http_request_header); + buffer_free(http_request_header); + if(do_prometheus_remote_write) protocol_buffers_shutdown(); - } #endif if(sock != -1) |