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

Uma Maheswara Rao G commented on HADOOP-7607:
---------------------------------------------

Hi Aaron,

I have uploaded the patch!

Scenario to reproduce it:
 1)Remove the implement Closeable and close method from RetryInvocationHandler.
   This is just to simulate Non closeable InvocationHandler.

 2) Try to run some tests. (I ran the TestBalancer.java)

in RPC.java's stopProxy API (see below)

 {code}
if (proxy != null && invocationHandler != null &&
        invocationHandler instanceof Closeable) {
      try {
        ((Closeable)invocationHandler).close();
      } catch (IOException e) {
        LOG.error("Stopping RPC invocation handler caused exception", e);
      }
    } else {
      LOG.error("Could not get invocation handler " + invocationHandler +
          " for proxy " + proxy + ", or invocation handler is not closeable.");
    }
{code}

since it is not a Closeable it will go to else. Here when printing proxy in 
log, it will try to invoke toString API. 

This will throw NosuchMethodException.

I don't have ready made test case to reproduce it.
Below is the trace:

java.lang.reflect.UndeclaredThrowableException
        at $Proxy11.toString(Unknown Source)
        at java.lang.String.valueOf(Unknown Source)
        at java.lang.StringBuilder.append(Unknown Source)
        at org.apache.hadoop.ipc.RPC.stopProxy(RPC.java:492)
        at org.apache.hadoop.hdfs.DFSClient.close(DFSClient.java:381)
        at 
org.apache.hadoop.hdfs.MiniDFSCluster.waitActive(MiniDFSCluster.java:1510)
        at 
org.apache.hadoop.hdfs.MiniDFSCluster.waitActive(MiniDFSCluster.java:1521)
        at 
org.apache.hadoop.hdfs.MiniDFSCluster.startDataNodes(MiniDFSCluster.java:916)
        at 
org.apache.hadoop.hdfs.MiniDFSCluster.startDataNodes(MiniDFSCluster.java:782)
        at 
org.apache.hadoop.hdfs.MiniDFSCluster.initMiniDFSCluster(MiniDFSCluster.java:563)
        at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:257)
        at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:250)
        at 
org.apache.hadoop.hdfs.MiniDFSCluster$Builder.build(MiniDFSCluster.java:243)
        at 
org.apache.hadoop.hdfs.server.balancer.TestBalancer.doTest(TestBalancer.java:305)
        at 
org.apache.hadoop.hdfs.server.balancer.TestBalancer.oneNodeTest(TestBalancer.java:346)
        at 
org.apache.hadoop.hdfs.server.balancer.TestBalancer.testBalancer0(TestBalancer.java:366)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NoSuchMethodException: 
org.apache.hadoop.hdfs.protocol.ClientProtocol.toString()
        at java.lang.Class.getMethod(Unknown Source)
        at 
org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:70)
        ... 35 more


> Simplify the RPC proxy cleanup process
> --------------------------------------
>
>                 Key: HADOOP-7607
>                 URL: https://issues.apache.org/jira/browse/HADOOP-7607
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: ipc
>    Affects Versions: 0.24.0
>            Reporter: Aaron T. Myers
>            Assignee: Aaron T. Myers
>             Fix For: 0.24.0
>
>         Attachments: HADOOP-7607.2.patch, hadoop-7607.0.patch, 
> hadoop-7607.1.patch
>
>
> The process to clean up an RPC proxy object is to call RPC.stopProxy, which 
> looks up the RPCEngine previously associated with the interface which that 
> proxy object provides and calls RPCEngine.stopProxy passing in the proxy 
> object. Every concrete implementation of RPCEngine.stopProxy then looks up 
> the invocation handler associated with the proxy object and calls close() on 
> that invocation handler.
> This process can be simplified by cutting out the steps of looking up the 
> previously-registered RPCEngine, and instead just having RPC.stopProxy 
> directly look up the invocation handler for the proxy object and call close() 
> on it.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to