-
Type:
Bug
-
Status: Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Component/s: None
-
Labels:
-
Hadoop Flags:Reviewed
-
Flags:Patch
I submitted a CR for this issue at:
https://github.com/apache/hadoop/pull/1015
The field storageMap (a HashMap)
is typically protected by synchronization on storageMap, e.g.,
For a total of 9 locations.
The reason is because HashMap is not thread safe.
However, here:
DatanodeStorageInfo storage =
storageMap.get(report.getStorage().getStorageID());
It is not synchronized.
Note that in the same method:
storageMap is again protected by synchronization:
synchronized (storageMap) {
storageMapSize = storageMap.size();
}
The CR I inlined above protected the above instance (line 455 ) with synchronization
like in line 484 and in all other occurrences.