aboutsummaryrefslogtreecommitdiff
path: root/src/common/Metric
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2017-12-02 20:24:30 +0100
committerfunjoker <funjoker109@gmail.com>2021-02-25 18:50:55 +0100
commit246871e3d549b4ea23576cccc7af676fe1579ce1 (patch)
tree789e000788570c3b19231ed911d2822b18a5ea4d /src/common/Metric
parent96406e340885948784bcffb5354f270d7485ae98 (diff)
Shared/Metric: Stop metrics on shutdown
Properly stop metric information gathering and sending on shutdown. Issue reported by AddressSanitizer. (cherry picked from commit e9c475d45f7fbe78d68e8d0cafe66b829acb6ce6)
Diffstat (limited to 'src/common/Metric')
-rw-r--r--src/common/Metric/Metric.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp
index 27e8996f112..45893fc1b14 100644
--- a/src/common/Metric/Metric.cpp
+++ b/src/common/Metric/Metric.cpp
@@ -217,7 +217,12 @@ void Metric::ForceSend()
{
// Send what's queued only if IoContext is stopped (so only on shutdown)
if (_enabled && Trinity::Asio::get_io_context(*_batchTimer).stopped())
+ {
+ _enabled = false;
SendBatch();
+ _batchTimer->cancel();
+ _overallStatusTimer->cancel();
+ }
}
void Metric::ScheduleOverallStatusLog()