You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@giraph.apache.org by pa...@apache.org on 2014/05/14 00:08:14 UTC
git commit: updated refs/heads/trunk to 2a7ea8b
Repository: giraph
Updated Branches:
refs/heads/trunk 400b7706a -> 2a7ea8b83
GIRAPH-896: Fix memory leak in SuperstepMetricsRegistry (edunov via pavanka)
Project: http://git-wip-us.apache.org/repos/asf/giraph/repo
Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/2a7ea8b8
Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/2a7ea8b8
Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/2a7ea8b8
Branch: refs/heads/trunk
Commit: 2a7ea8b8389c103b03df961f8d6a9b5571caa991
Parents: 400b770
Author: Pavan Kumar <pa...@fb.com>
Authored: Tue May 13 15:07:29 2014 -0700
Committer: Pavan Kumar <pa...@fb.com>
Committed: Tue May 13 15:07:51 2014 -0700
----------------------------------------------------------------------
CHANGELOG | 2 +
.../NettyWorkerClientRequestProcessor.java | 50 +++++++++++++-------
2 files changed, 35 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/giraph/blob/2a7ea8b8/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index b51ccf6..3f0d819 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
Giraph Change Log
Release 1.1.0 - unreleased
+ GIRAPH-896: Fix memory leak in SuperstepMetricsRegistry (edunov via pavanka)
+
GIRAPH-897: Add an option to dump only live objects to JMap (edunov via pavanka)
GIRAPH-895: Trim the edges in Giraph (edunov via pavanka)
http://git-wip-us.apache.org/repos/asf/giraph/blob/2a7ea8b8/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyWorkerClientRequestProcessor.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyWorkerClientRequestProcessor.java b/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyWorkerClientRequestProcessor.java
index 0166713..43c01ce 100644
--- a/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyWorkerClientRequestProcessor.java
+++ b/giraph-core/src/main/java/org/apache/giraph/comm/netty/NettyWorkerClientRequestProcessor.java
@@ -155,23 +155,7 @@ public class NettyWorkerClientRequestProcessor<I extends WritableComparable,
SuperstepMetricsRegistry smr = GiraphMetrics.get().perSuperstep();
localRequests = smr.getCounter(MetricNames.LOCAL_REQUESTS);
remoteRequests = smr.getCounter(MetricNames.REMOTE_REQUESTS);
- final Gauge<Long> totalRequests = smr.getGauge(MetricNames.TOTAL_REQUESTS,
- new Gauge<Long>() {
- @Override
- public Long value() {
- return localRequests.count() + remoteRequests.count();
- }
- }
- );
- smr.getGauge(MetricNames.PERCENT_LOCAL_REQUESTS, new PercentGauge() {
- @Override protected double getNumerator() {
- return localRequests.count();
- }
-
- @Override protected double getDenominator() {
- return totalRequests.value();
- }
- });
+ setupGauges(smr, localRequests, remoteRequests);
}
@Override
@@ -487,4 +471,36 @@ public class NettyWorkerClientRequestProcessor<I extends WritableComparable,
remoteRequests.inc();
}
}
+
+ /**
+ * Sets up gauges for superstep metrics.
+ * This has to be static so that internal objects created here don't
+ * hold references to this$0. Otherwise we memory leaking
+ * NettyWorkerClientRequestProcessor objects.
+ *
+ * @param smr metric registry for current superstep
+ * @param localRequests counter for local requests
+ * @param remoteRequests counter for remote requests
+ */
+ private static void setupGauges(SuperstepMetricsRegistry smr,
+ final Counter localRequests,
+ final Counter remoteRequests) {
+ final Gauge<Long> totalRequests = smr.getGauge(MetricNames.TOTAL_REQUESTS,
+ new Gauge<Long>() {
+ @Override
+ public Long value() {
+ return localRequests.count() + remoteRequests.count();
+ }
+ }
+ );
+ smr.getGauge(MetricNames.PERCENT_LOCAL_REQUESTS, new PercentGauge() {
+ @Override protected double getNumerator() {
+ return localRequests.count();
+ }
+
+ @Override protected double getDenominator() {
+ return totalRequests.value();
+ }
+ });
+ }
}