[
https://issues.apache.org/jira/browse/HDFS-9649?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
emopers updated HDFS-9649:
--------------------------
Attachment: HDFS-9649.patch
> 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
> Attachments: HDFS-9649.patch
>
>
> 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)