[ 
https://issues.apache.org/jira/browse/HADOOP-9439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13677465#comment-13677465
 ] 

Todd Lipcon commented on HADOOP-9439:
-------------------------------------

Also, looks like you missed the following:

bq. <Todd> We may have to actually share this lock and configuration with the 
lock used in NativeIO.c.
bq. <Colin> yeah, let's do that.

Instead you're just sharing between the user_info and group_info, but not the 
lock used by NativeIO.c (which is actually a java monitor lock rather than a 
pthread mutex).

Given the above, why not something like the following:

- move the lock object from NativeIO.c to be defined in the NativeIO.java class 
as a static field
- change the Java code in both places to just do something like:

{code}
if (shouldLock) {
  synchronized (lockObject) {
    return myJniCall(...);
  }
} else {
  return myJniCall(...);
}
{code}

Would that end up simpler?
                
> JniBasedUnixGroupsMapping: fix some crash bugs
> ----------------------------------------------
>
>                 Key: HADOOP-9439
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9439
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: native
>    Affects Versions: 2.0.4-alpha
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>            Priority: Minor
>         Attachments: HADOOP-9439.001.patch, HADOOP-9439.003.patch, 
> HDFS-4640.002.patch
>
>
> JniBasedUnixGroupsMapping has some issues.
> * sometimes on error paths variables are freed prior to being initialized
> * re-allocate buffers less frequently (can reuse the same buffer for multiple 
> calls to getgrnam)
> * allow non-reentrant functions to be used, to work around client bugs
> * don't throw IOException from JNI functions if the JNI functions do not 
> declare this checked exception.
> * don't bail out if only one group name among all the ones associated with a 
> user can't be looked up.

--
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

Reply via email to