Skip to content

Commit 4897454

Browse files
committed
HADOOP-18526. s3a instrumentation
* use the weak ref when registering * log state of cache.disabled in trace-level constructor The reason for the logging is that running out of memory due to instrumentation refs is probably a sign of s3a fs instances being created and not closed. HADOOP-18476 should partially address this through FileContext; the trace is there to identify other possible causes. Change-Id: If78d16e8bfc63eea93ec328543ab110f82c93d90
1 parent f8cdd3d commit 4897454

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AFileSystem.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,9 @@ public void initialize(URI name, Configuration originalConf)
461461
if (LOG.isTraceEnabled()) {
462462
// log a full trace for deep diagnostics of where an object is created,
463463
// for tracking down memory leak issues.
464-
LOG.trace("Filesystem for {} creation stack",
465-
name, new RuntimeException(super.toString()));
464+
LOG.trace("Filesystem for {} created; fs.s3a.impl.disable.cache = {}",
465+
name, originalConf.getBoolean("fs.s3a.impl.disable.cache", false),
466+
new RuntimeException(super.toString()));
466467
}
467468
// clone the configuration into one with propagated bucket options
468469
Configuration conf = propagateBucketOptions(originalConf, bucket);

hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInstrumentation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ static boolean hasMetricSystem() {
263263
}
264264

265265
/**
266-
* Register this instance as a metrics source.
266+
* Register this instance as a metrics source via a weak reference.
267267
* @param name s3a:// URI for the associated FileSystem instance
268268
*/
269269
private void registerAsMetricsSource(URI name) {
@@ -277,7 +277,7 @@ private void registerAsMetricsSource(URI name) {
277277
String msName = METRICS_SOURCE_BASENAME + number;
278278
String metricsSourceName = msName + "-" + name.getHost();
279279
metricsSourceReference = new WeakRefMetricsSource(metricsSourceName, this);
280-
metricsSystem.register(metricsSourceName, "", this);
280+
metricsSystem.register(metricsSourceName, "", metricsSourceReference);
281281
}
282282

283283
/**

0 commit comments

Comments
 (0)