From 4e21c347d2e2770a79b11d2d83c835c9bcaa2a89 Mon Sep 17 00:00:00 2001 From: Suresh Srinivas Date: Sat, 27 Apr 2013 14:08:34 +0000 Subject: [PATCH] HDFS-4768. File handle leak in datanode when a block pool is removed. Contributed by Chris Nauroth. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1476579 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../apache/hadoop/hdfs/server/datanode/DataBlockScanner.java | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index c7a8f2e8405..77446a1425d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -582,6 +582,9 @@ Release 2.0.5-beta - UNRELEASED HDFS-4745. TestDataTransferKeepalive#testSlowReader has race condition that causes sporadic failure. (Chris Nauroth via suresh) + HDFS-4768. File handle leak in datanode when a block pool is removed. + (Chris Nauroth via suresh) + Release 2.0.4-alpha - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java index cf80c99a58a..f9f8d328b4f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataBlockScanner.java @@ -267,7 +267,10 @@ public class DataBlockScanner implements Runnable { } public synchronized void removeBlockPool(String blockPoolId) { - blockPoolScannerMap.remove(blockPoolId); + BlockPoolSliceScanner bpss = blockPoolScannerMap.remove(blockPoolId); + if (bpss != null) { + bpss.shutdown(); + } LOG.info("Removed bpid="+blockPoolId+" from blockPoolScannerMap"); }