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

Szilard Nemeth commented on YARN-9868:
--------------------------------------

Hi [[email protected]]!
I'm wondering about the following piece of code you have added in 
UserGroupMappingPlacementRule#getPlacementForUser: 

{code:java}
if (this.queueManager
                .getQueue(groups.getGroups(user).get(0)) != null) {
              QueueMapping queueMapping = new QueueMapping(mapping.getType(),
                  mapping.getSource(), user, groups.getGroups(user).get(0));
{code}

Can it happen that 
{code:java}
groups.getGroups(user)
{code}
returns null or an empty list for a user? Is this a valid case? If so, the code 
would break as you are always accessing the 0th element of the list.
Please add a testcase for this at least.
Anyway,  I checked the implementation of 
org.apache.hadoop.security.Groups#getGroups and this piece of code seems 
unguarded for empty / null lists: 

{code:java}
try {
      return cache.get(user);
    } catch (ExecutionException e) {
      throw (IOException)e.getCause();
    }
{code}

Apart from this, latest patch looks good.



> Validate %primary_group queue in CS queue manager
> -------------------------------------------------
>
>                 Key: YARN-9868
>                 URL: https://issues.apache.org/jira/browse/YARN-9868
>             Project: Hadoop YARN
>          Issue Type: Improvement
>            Reporter: Manikandan R
>            Assignee: Manikandan R
>            Priority: Major
>         Attachments: YARN-9868-003.patch, YARN-9868-003.patch, 
> YARN-9868-004.patch, YARN-9868.001.patch, YARN-9868.002.patch, 
> YARN-9868.005.patch
>
>
> As part of %secondary_group mapping, we ensure o/p of %secondary_group while 
> processing the queue mapping is available using CSQueueManager. Similarly, we 
> will need to same forĀ %primary_group.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to