hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hari Shreedharan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-9107) Hadoop IPC client eats InterruptedException and sets interrupt on the thread which is not documented
Date Fri, 30 Nov 2012 21:23:58 GMT

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

Hari Shreedharan commented on HADOOP-9107:
------------------------------------------

I agree that both are pretty similar, but I think we still need to do the cleanup I am proposing
here right?
                
> Hadoop IPC client eats InterruptedException and sets interrupt on the thread which is
not documented
> ----------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-9107
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9107
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: ipc
>    Affects Versions: 1.1.0, 2.0.2-alpha
>            Reporter: Hari Shreedharan
>
> This code in Client.java looks fishy:
> {code}
>   public Writable call(RPC.RpcKind rpcKind, Writable rpcRequest,
>       ConnectionId remoteId) throws InterruptedException, IOException {
>     Call call = new Call(rpcKind, rpcRequest);
>     Connection connection = getConnection(remoteId, call);
>     connection.sendParam(call);                 // send the parameter
>     boolean interrupted = false;
>     synchronized (call) {
>       while (!call.done) {
>         try {
>           call.wait();                           // wait for the result
>         } catch (InterruptedException ie) {
>           // save the fact that we were interrupted
>           interrupted = true;
>         }
>       }
>       if (interrupted) {
>         // set the interrupt flag now that we are done waiting
>         Thread.currentThread().interrupt();
>       }
>       if (call.error != null) {
>         if (call.error instanceof RemoteException) {
>           call.error.fillInStackTrace();
>           throw call.error;
>         } else { // local exception
>           InetSocketAddress address = connection.getRemoteAddress();
>           throw NetUtils.wrapException(address.getHostName(),
>                   address.getPort(),
>                   NetUtils.getHostname(),
>                   0,
>                   call.error);
>         }
>       } else {
>         return call.getRpcResult();
>       }
>     }
>   }
> {code}
> Blocking calls are expected to throw InterruptedException if that is interrupted. Also
it seems like this method waits on the call objects even if it  is interrupted. Currently,
this method does not throw an InterruptedException, nor is it documented that this method
interrupts the thread calling it. If it is interrupted, this method should still throw InterruptedException,
it should not matter if the call was successful or not.
> This is a major issue for clients which do not call this directly, but call HDFS client
API methods to write to HDFS, which may be interrupted by the client due to timeouts, but
does not throw InterruptedException. Any HDFS client calls can interrupt the thread but it
is not documented anywhere. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message