[ 
https://issues.apache.org/jira/browse/HDFS-1257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12881893#action_12881893
 ] 

Ramkumar Vadali commented on HDFS-1257:
---------------------------------------

My proposal is to wrap FSNamesystem#recentInvalidateSets in 
Collections.synchronizedMap(). That should fix this problem.


--- a/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
+++ b/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
@@ -189,7 +189,7 @@ public class FSNamesystem implements FSConstants, 
FSNamesystemMBean, FSClusterSt
   // Mapping: StorageID -> ArrayList<Block>
   //
   private Map<String, Collection<Block>> recentInvalidateSets = 
-    new TreeMap<String, Collection<Block>>();
+    Collections.synchronizedMap(new TreeMap<String, Collection<Block>>());
 
   //
   // Keeps a TreeSet for every named node.  Each treeset contains


> Race condition introduced by HADOOP-5124
> ----------------------------------------
>
>                 Key: HDFS-1257
>                 URL: https://issues.apache.org/jira/browse/HDFS-1257
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: name-node
>            Reporter: Ramkumar Vadali
>
> HADOOP-5124 provided some improvements to FSNamesystem#recentInvalidateSets. 
> But it introduced unprotected access to the data structure 
> recentInvalidateSets. Specifically, FSNamesystem.computeInvalidateWork 
> accesses recentInvalidateSets without read-lock protection. If there is 
> concurrent activity (like reducing replication on a file) that adds to 
> recentInvalidateSets, the name-node crashes with a 
> ConcurrentModificationException.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to