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

Konstantin Shvachko commented on HDFS-14116:
--------------------------------------------

Noticed the same problem with fsck
{code}
Exception in thread "main" java.lang.ClassCastException: 
org.apache.hadoop.hdfs.server.namenode.ha.ObserverReadProxyProvider$ObserverReadInvocationHandler
 cannot be cast to org.apache.hadoop.ipc.RpcInvocationHandler
        at org.apache.hadoop.ipc.RPC.getConnectionIdForProxy(RPC.java:666)
        at 
org.apache.hadoop.io.retry.RetryInvocationHandler.getConnectionId(RetryInvocationHandler.java:449)
        at org.apache.hadoop.ipc.RPC.getConnectionIdForProxy(RPC.java:667)
        at org.apache.hadoop.ipc.RPC.getServerAddress(RPC.java:650)
        at org.apache.hadoop.hdfs.HAUtil.getAddressOfActive(HAUtil.java:268)
        at 
org.apache.hadoop.hdfs.tools.DFSck.getCurrentNamenodeAddress(DFSck.java:266)
        at org.apache.hadoop.hdfs.tools.DFSck.doWork(DFSck.java:332)
        at org.apache.hadoop.hdfs.tools.DFSck.access$000(DFSck.java:72)
        at org.apache.hadoop.hdfs.tools.DFSck$1.run(DFSck.java:159)
        at org.apache.hadoop.hdfs.tools.DFSck$1.run(DFSck.java:156)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729)
        at org.apache.hadoop.hdfs.tools.DFSck.run(DFSck.java:155)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:90)
        at org.apache.hadoop.hdfs.tools.DFSck.main(DFSck.java:402)
[{code}

> Fix a potential class cast error in ObserverReadProxyProvider
> -------------------------------------------------------------
>
>                 Key: HDFS-14116
>                 URL: https://issues.apache.org/jira/browse/HDFS-14116
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs-client
>            Reporter: Chen Liang
>            Assignee: Chao Sun
>            Priority: Major
>
> Currently in {{ObserverReadProxyProvider}} constructor there is this line 
> {code}
> ((ClientHAProxyFactory<T>) factory).setAlignmentContext(alignmentContext);
> {code}
> This could potentially cause failure, because it is possible that factory can 
> not be casted here. Specifically,  
> {{NameNodeProxiesClient.createFailoverProxyProvider}} is where the 
> constructor will be called, and there are two paths that could call into this:
> (1).{{NameNodeProxies.createProxy}}
> (2).{{NameNodeProxiesClient.createFailoverProxyProvider}}
> (2) works fine because it always uses {{ClientHAProxyFactory}} but (1) uses 
> {{NameNodeHAProxyFactory}} which can not be casted to 
> {{ClientHAProxyFactory}}, this happens when, for example, running 
> NNThroughputBenmarck. To fix this we can at least:
> 1. introduce setAlignmentContext to HAProxyFactory which is the parent of 
> both  ClientHAProxyFactory and NameNodeHAProxyFactory OR
> 2. only setAlignmentContext when it is ClientHAProxyFactory by, say, having a 
> if check with reflection. 
> Depending on whether it make sense to have alignment context for the case (1) 
> calling code paths.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to