hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron T. Myers (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HDFS-4522) LightWeightGSet expects incrementing a volatile to be atomic
Date Wed, 13 Mar 2013 03:00:13 GMT

     [ https://issues.apache.org/jira/browse/HDFS-4522?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Aaron T. Myers updated HDFS-4522:
---------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.5-beta
           Status: Resolved  (was: Patch Available)

I've just committed this to trunk and branch-2.

Thanks a lot for the contribution, Colin.
                
> LightWeightGSet expects incrementing a volatile to be atomic
> ------------------------------------------------------------
>
>                 Key: HDFS-4522
>                 URL: https://issues.apache.org/jira/browse/HDFS-4522
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 2.0.5-beta
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>            Priority: Minor
>             Fix For: 2.0.5-beta
>
>         Attachments: HDFS-4522.001.patch, HDFS-4522.002.patch
>
>
> 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:
> {code}
>      //insert the element to the head of the linked list
>      modification++;
>      size++;
> {code}
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message