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

zhihai xu resolved YARN-3263.
-----------------------------
    Resolution: Not a Problem

This is not an issue.
tokens.rewind() is called before credentials.readTokenStorageStream(buf).
This will have the same effect as rewind after readTokenStorageStream.
Also no other place accesses the tokens except parseCredentials.

> ContainerManagerImpl#parseCredentials don't rewind the ByteBuffer after 
> credentials.readTokenStorageStream
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: YARN-3263
>                 URL: https://issues.apache.org/jira/browse/YARN-3263
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: nodemanager
>            Reporter: zhihai xu
>            Assignee: zhihai xu
>
> ContainerManagerImpl#parseCredentials don't rewind the ByteBuffer after 
> credentials.readTokenStorageStream. So the next time if we access Tokens, we 
> will have EOFException.
> The following is the code for parseCredentials in ContainerManagerImpl.
> {code}
>   private Credentials parseCredentials(ContainerLaunchContext launchContext)
>       throws IOException {
>     Credentials credentials = new Credentials();
>     // //////////// Parse credentials
>     ByteBuffer tokens = launchContext.getTokens();
>     if (tokens != null) {
>       DataInputByteBuffer buf = new DataInputByteBuffer();
>       tokens.rewind();
>       buf.reset(tokens);
>       credentials.readTokenStorageStream(buf);
>       if (LOG.isDebugEnabled()) {
>         for (Token<? extends TokenIdentifier> tk : 
> credentials.getAllTokens()) {
>           LOG.debug(tk.getService() + " = " + tk.toString());
>         }
>       }
>     }
>     // //////////// End of parsing credentials
>     return credentials;
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to