From d9c409a4286e36387fb39e7d622e850c13315465 Mon Sep 17 00:00:00 2001 From: Colin Patrick Mccabe Date: Tue, 23 Feb 2016 11:11:22 -0800 Subject: [PATCH] HADOOP-12829. StatisticsDataReferenceCleaner swallows interrupt exceptions (Gregory Chanan via cmccabe) --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/fs/FileSystem.java | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 361859ab3b..d405af3aa3 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -719,6 +719,9 @@ Release 2.9.0 - UNRELEASED HADOOP-12714. Fix hadoop-mapreduce-client-nativetask unit test which fails because it is not able to open the "glibc bug spill" file. (cmccabe) + HADOOP-12829. StatisticsDataReferenceCleaner swallows interrupt exceptions + (Gregory Chanan via cmccabe) + Release 2.8.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java index 3e26f68c52..8c1d57b4e2 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java @@ -3184,15 +3184,16 @@ public void cleanUp() { private static class StatisticsDataReferenceCleaner implements Runnable { @Override public void run() { - while (true) { + while (!Thread.interrupted()) { try { StatisticsDataReference ref = (StatisticsDataReference)STATS_DATA_REF_QUEUE.remove(); ref.cleanUp(); + } catch (InterruptedException ie) { + LOG.warn("Cleaner thread interrupted, will stop", ie); + Thread.currentThread().interrupt(); } catch (Throwable th) { - // the cleaner thread should continue to run even if there are - // exceptions, including InterruptedException - LOG.warn("exception in the cleaner thread but it will continue to " + LOG.warn("Exception in the cleaner thread but it will continue to " + "run", th); } }