HADOOP-19049. Fix StatisticsDataReferenceCleaner classloader leak (#6488)
Contributed by Jia Fan
This commit is contained in:
parent
141627778d
commit
4f0f5a546c
@ -4077,6 +4077,7 @@ private interface StatisticsAggregator<T> {
|
|||||||
STATS_DATA_CLEANER.
|
STATS_DATA_CLEANER.
|
||||||
setName(StatisticsDataReferenceCleaner.class.getName());
|
setName(StatisticsDataReferenceCleaner.class.getName());
|
||||||
STATS_DATA_CLEANER.setDaemon(true);
|
STATS_DATA_CLEANER.setDaemon(true);
|
||||||
|
STATS_DATA_CLEANER.setContextClassLoader(null);
|
||||||
STATS_DATA_CLEANER.start();
|
STATS_DATA_CLEANER.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tests basic operations of {@link FileSystemStorageStatistics} class.
|
* This tests basic operations of {@link FileSystemStorageStatistics} class.
|
||||||
@ -102,6 +103,14 @@ public void testGetLong() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStatisticsDataReferenceCleanerClassLoader() {
|
||||||
|
Thread thread = Thread.getAllStackTraces().keySet().stream()
|
||||||
|
.filter(t -> t.getName().contains("StatisticsDataReferenceCleaner")).findFirst().get();
|
||||||
|
ClassLoader classLoader = thread.getContextClassLoader();
|
||||||
|
assertNull(classLoader);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to retrieve the specific FileSystem.Statistics value by name.
|
* Helper method to retrieve the specific FileSystem.Statistics value by name.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user