aboutsummaryrefslogtreecommitdiffstats
path: root/metrics
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2020-07-13 08:54:15 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2020-07-13 09:04:50 +0000
commitccc59fb7598ee714d0119e7e8de39699e467603c (patch)
tree149b1086d83e9e7e14e0dc81d1658f757e89926b /metrics
parent9baa67e082830e31e47b2881737351cb1828d64f (diff)
Shutdown state server and metric manager before service layer
Avoids a very small race condition window where metric update hooks may point into the service layer components even after they have been destroyed, as these are not explicitly unregistered today. Another option would be to add unregistering on component destruction, but that adds another race condition where an external client may observe partial metric existence during this time window. By shutting down the metric exporting interfaces first, we should avoid this.
Diffstat (limited to 'metrics')
-rw-r--r--metrics/src/vespa/metrics/metricmanager.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/metrics/src/vespa/metrics/metricmanager.cpp b/metrics/src/vespa/metrics/metricmanager.cpp
index 7ac912416de..84e92c2c316 100644
--- a/metrics/src/vespa/metrics/metricmanager.cpp
+++ b/metrics/src/vespa/metrics/metricmanager.cpp
@@ -94,6 +94,9 @@ MetricManager::~MetricManager()
void
MetricManager::stop()
{
+ if (!running()) {
+ return; // Let stop() be idempotent.
+ }
Runnable::stop();
{
vespalib::MonitorGuard sync(_waiter);