[
https://issues.apache.org/jira/browse/HADOOP-10852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14245875#comment-14245875
]
Arpit Agarwal commented on HADOOP-10852:
----------------------------------------
+1 for the patch except for some formatting. Feel free to commit after fixing
it.
# Space between {{//}} and comment text. e.g. _//ConcurrentHashMap does not
allow null values;_
# Spaces around tokens in for e.g. _String user:users_
The patch looks good otherwise and existing unit tests look sufficient.
> NetgroupCache is not thread-safe
> --------------------------------
>
> Key: HADOOP-10852
> URL: https://issues.apache.org/jira/browse/HADOOP-10852
> Project: Hadoop Common
> Issue Type: Bug
> Components: security
> Affects Versions: 2.5.0, 2.4.1
> Reporter: Benoy Antony
> Assignee: Benoy Antony
> Attachments: HADOOP-10852.patch, HADOOP-10852.patch,
> HADOOP-10852.patch
>
>
> _NetgroupCache_ internally uses two ConcurrentHashMaps and a boolean variable
> to signal updates on one of the ConcurrentHashMap
> None of the functions are synchronized and hence is possible to have
> unexpected results due to race condition between different threads.
> As an example, consider the following sequence:
> Thread1 :
> {{add}} a group
> {{netgroupToUsersMap}} is updated.
> {{netgroupToUsersMapUpdated}} is set to true.
> Thread 2:
> calls {{getNetgroups}} for a user
> Due to re-ordering, {{netgroupToUsersMapUpdated=true}} is visible, but
> updates in {{netgroupToUsersMap}} is not visible.
> Does a wrong update with older {{netgroupToUsersMap}} values.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)