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

Thejas M Nair edited comment on HIVE-13075 at 2/19/16 3:03 AM:
---------------------------------------------------------------

[~wikp] Thanks for reporting this and the diagnosis!
I should have checked for this first. Lets track it in the new jira with the 
patch. 



was (Author: thejas):
[~wikp] Thanks for reporting this and the diagnosis!
I should have checked this first. Lets track it in the new jira with the patch. 


> Metastore shuts down when no delegation token is found in ZooKeeper
> -------------------------------------------------------------------
>
>                 Key: HIVE-13075
>                 URL: https://issues.apache.org/jira/browse/HIVE-13075
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 1.3.0, 1.2.1
>            Reporter: Piotr Wikieł
>            Priority: Minor
>
> {{ZooKeeperTokenStore}} looks [as 
> follows|https://github.com/apache/hive/blob/branch-1.2/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java#L397]:
> {code:java}
> @Override
> public DelegationTokenInformation getToken(DelegationTokenIdentifier 
> tokenIdentifier) {
>   byte[] tokenBytes = zkGetData(getTokenPath(tokenIdentifier));
>   try {
>     return 
> HiveDelegationTokenSupport.decodeDelegationTokenInformation(tokenBytes);
>   } catch (Exception ex) {
>     throw new TokenStoreException("Failed to decode token", ex);
>   }
> }
> {code}
> which is slightly different from [DBTokenStore 
> implementation|https://github.com/apache/hive/blob/branch-1.2/shims/common/src/main/java/org/apache/hadoop/hive/thrift/DBTokenStore.java#L85]
>  that is protected against {{tokenBytes==null}} because nullable 
> {{tokenBytes}} causes NPE to be thrown in 
> [HiveDelegationTokenSupport#decodeDelegationTokenInformation|https://github.com/apache/hive/blob/branch-1.2/shims/common/src/main/java/org/apache/hadoop/security/token/delegation/HiveDelegationTokenSupport.java#L51]
> Furthermore, NPE thrown here causes 
> [TokenStoreDelegationTokenSecretManager.ExpiredTokenRemover|https://github.com/apache/hive/blob/branch-1.2/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java#L333]
>  to catch it and exits MetaStore.
> {{null}} from 
> {{[zkGetData()|https://github.com/apache/hive/blob/branch-1.2/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java#L284]}}
>  is possible during ZooKeeper failure or (and that was our case) when another 
> metastore instance removes tokens during {{ExpiredTokenRemover}} run. There 
> were two solutions of this problem:
>  * distributed lock in ZooKeeper acquired during one metastore instance's 
> ExpiredTokenRemover run,
>  * simple null check
> I think null check is sufficient if it is in {{DBTokenStore}}.
> Patch will be attached.
> Sorry for an edit but I think worth mentioning is a fact that possible 
> workaround for this issue is setting 
> {{hive.cluster.delegation.key.update-interval}}, 
> {{hive.cluster.delegation.token.renew-interval}} and 
> {{hive.cluster.delegation.token.max-lifetime}} to one year as described 
> [here|https://community.cloudera.com/t5/Web-UI-Hue-Beeswax/Potential-misconfiguration-detected-Hue-Hive-Editor-HiveServer2/m-p/26117/highlight/true#M763].
>  But in my opinion it is not an engineer-way of doing things ;)



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

Reply via email to