From 84abf3a1a60ef93d757af83fc2b85503663d577e Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 2 Dec 2017 20:24:30 +0100 Subject: [PATCH] Shared/Metric: Stop metrics on shutdown Properly stop metric information gathering and sending on shutdown. Issue reported by AddressSanitizer. --- src/common/Metric/Metric.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp index 7091dd0d376..bd85342be87 100644 --- a/src/common/Metric/Metric.cpp +++ b/src/common/Metric/Metric.cpp @@ -212,7 +212,12 @@ void Metric::ForceSend() { // Send what's queued only if io_service is stopped (so only on shutdown) if (_enabled && _batchTimer->get_io_service().stopped()) + { + _enabled = false; SendBatch(); + _batchTimer->cancel(); + _overallStatusTimer->cancel(); + } } void Metric::ScheduleOverallStatusLog()