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

zhihai xu updated YARN-3263:
----------------------------
    Description: 
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}

  was:ContainerManagerImpl#parseCredentials don't rewind the ByteBuffer after 
credentials.readTokenStorageStream. So the next time if we access Tokens, we 
will have EOFException.


> 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