emopers created HDFS-9649:
-----------------------------

             Summary: NNStorage does not synchronize iteration on a 
synchronized list
                 Key: HDFS-9649
                 URL: https://issues.apache.org/jira/browse/HDFS-9649
             Project: Hadoop HDFS
          Issue Type: Bug
            Reporter: emopers


In line 839 of NNStroage.java#reportErrorsOnDirectories, the synchronized list, 
`sds` is iterated in an unsynchronized manner, but according to [Oracle Java 7 
API 
specification](http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedList(java.util.List)),
this is not thread-safe and can lead to non-deterministic behavior.
This could be fix by synchronizing the iteration on `sds`. The synchronized 
list is passed to method `reportErrorsOnDirectories` from 
(https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L508)

I have already submitted submitted a PR at 
https://github.com/apache/hadoop/pull/64 . Let me know if it looks good so that 
I can generate patch and submit it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to