Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.1.0-beta
-
None
-
None
-
Reviewed
Description
LightWeightGSet uses a volatile integer to track the current modification number (kind of an epoch number).
Unfortunately, it includes code like this, that increments this volatile int:
//insert the element to the head of the linked list
modification++;
size++;
The bug here is that in between reading the value of modification, incrementing it, and storing it back in the variable, another thread may have modified it. This could lead to lost updates.
We should use AtomicInteger for these cases.
Attachments
Attachments
Issue Links
- is related to
-
HADOOP-8594 Fix issues identified by findsbugs2
- Resolved
-
HDFS-5267 Remove volatile from LightWeightHashSet
- Closed