YARN-5296. NMs going OutOfMemory because ContainerMetrics leak in ContainerMonitorImpl. Contributed by Junping Du
This commit is contained in:
parent
ce9c006430
commit
d792a90206
@ -23,6 +23,7 @@
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@ -57,6 +58,7 @@ public class MutableQuantiles extends MutableMetric {
|
|||||||
|
|
||||||
private QuantileEstimator estimator;
|
private QuantileEstimator estimator;
|
||||||
private long previousCount = 0;
|
private long previousCount = 0;
|
||||||
|
private ScheduledFuture<?> scheduledTask = null;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected Map<Quantile, Long> previousSnapshot = null;
|
protected Map<Quantile, Long> previousSnapshot = null;
|
||||||
@ -105,8 +107,8 @@ public MutableQuantiles(String name, String description, String sampleName,
|
|||||||
estimator = new SampleQuantiles(quantiles);
|
estimator = new SampleQuantiles(quantiles);
|
||||||
|
|
||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
scheduler.scheduleAtFixedRate(new RolloverSample(this), interval, interval,
|
scheduledTask = scheduler.scheduleAtFixedRate(new RolloverSample(this),
|
||||||
TimeUnit.SECONDS);
|
interval, interval, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -135,6 +137,13 @@ public int getInterval() {
|
|||||||
return interval;
|
return interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
if (scheduledTask != null) {
|
||||||
|
scheduledTask.cancel(false);
|
||||||
|
}
|
||||||
|
scheduledTask = null;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void setEstimator(QuantileEstimator quantileEstimator) {
|
public synchronized void setEstimator(QuantileEstimator quantileEstimator) {
|
||||||
this.estimator = quantileEstimator;
|
this.estimator = quantileEstimator;
|
||||||
}
|
}
|
||||||
|
@ -250,6 +250,8 @@ public synchronized void finished() {
|
|||||||
timer = null;
|
timer = null;
|
||||||
}
|
}
|
||||||
scheduleTimerTaskForUnregistration();
|
scheduleTimerTaskForUnregistration();
|
||||||
|
this.pMemMBQuantiles.stop();
|
||||||
|
this.cpuCoreUsagePercentQuantiles.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user