Skip to content

Instantly share code, notes, and snippets.

@emopers
Created December 28, 2015 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emopers/fa54d1ad18f564a1e343 to your computer and use it in GitHub Desktop.
Save emopers/fa54d1ad18f564a1e343 to your computer and use it in GitHub Desktop.
sync_col_70
Title:
NNStorage does not synchronize iteration on a synchronized list
Body:
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 pull request adds a fix by synchronizing the iteration on `sds`. The synchronized list is passed to method `reportErrorsnODirectories` from
[here](https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L508)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment