You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2018/05/31 04:20:15 UTC
[2/2] mesos git commit: Fixed an issue in metrics where timers
accumulate.
Fixed an issue in metrics where timers accumulate.
Previously, we did not discard the `after(timeout)` future, which
results in a build-up of timers in libprocess (especially when
the timeout value is large). This updates the code to discard the
future if the metrics' futures complete.
It's still the case that we leave a very large clock tick scheduled
in libprocess for `Time::max()`, but the number of these scheduled
ticks should not grow beyond 1.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/0f6ce843
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/0f6ce843
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/0f6ce843
Branch: refs/heads/master
Commit: 0f6ce843b506262acdccba50e8686ca5798aa633
Parents: 9399d89
Author: Benjamin Mahler <bm...@apache.org>
Authored: Wed May 30 21:16:56 2018 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Wed May 30 21:19:16 2018 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/metrics/metrics.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/0f6ce843/3rdparty/libprocess/src/metrics/metrics.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/metrics/metrics.cpp b/3rdparty/libprocess/src/metrics/metrics.cpp
index ebdfcfd..e0d0ee4 100644
--- a/3rdparty/libprocess/src/metrics/metrics.cpp
+++ b/3rdparty/libprocess/src/metrics/metrics.cpp
@@ -155,10 +155,14 @@ Future<map<string, double>> MetricsProcess::snapshot(
statistics[name] = metric->statistics();
}
+ Future<Nothing> timedout =
+ after(timeout.getOrElse(Duration::max()));
+
// Return the response once it finishes or we time out.
return select<Nothing>({
- after(timeout.getOrElse(Duration::max())),
+ timedout,
await(futures.values()).then([]{ return Nothing(); }) })
+ .onAny([=]() mutable { timedout.discard(); }) // Don't accumulate timers.
.then(defer(self(),
&Self::__snapshot,
timeout,