[
https://issues.apache.org/jira/browse/HADOOP-9312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13593827#comment-13593827
]
Chuan Liu commented on HADOOP-9312:
-----------------------------------
I agree it is not thread safe.
The problem is mitigated a bit because "getGroups()" and "emptyGroups" are both
instance members not class members.
Do we require this class to be thread safe from its use pattern?
> JniBasedUnixGroupsMapping#getGroupForUser can potentially leak memory
> ---------------------------------------------------------------------
>
> Key: HADOOP-9312
> URL: https://issues.apache.org/jira/browse/HADOOP-9312
> Project: Hadoop Common
> Issue Type: Bug
> Components: native, security
> Affects Versions: 3.0.0, trunk-win
> Reporter: Chris Nauroth
>
> This method lazily initializes a static variable to contain an empty array of
> groups. If multiple threads call the method before the variable has been
> initialized, then there is potential for a race condition. This would cause
> multiple allocations of the array and leaked memory.
--
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