Hadoop Common
  1. Hadoop Common
  2. HADOOP-9107

Hadoop IPC client eats InterruptedException and sets interrupt on the thread which is not documented


    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.1.0, 2.0.2-alpha
    • Fix Version/s: None
    • Component/s: ipc
    • Labels:


      This code in Client.java looks fishy:

        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
            if (call.error != null) {
              if (call.error instanceof RemoteException) {
                throw call.error;
              } else { // local exception
                InetSocketAddress address = connection.getRemoteAddress();
                throw NetUtils.wrapException(address.getHostName(),
            } else {
              return call.getRpcResult();

      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.

        Issue Links


          Hari Shreedharan created issue -
          Hari Shreedharan made changes -
          Field Original Value New Value
          Affects Version/s 1.1.0 [ 12316501 ]
          Hari Shreedharan made changes -
          Link This issue relates to FLUME-1748 [ FLUME-1748 ]
          Steve Loughran made changes -
          Link This issue relates to HADOOP-6221 [ HADOOP-6221 ]
          Eli Collins made changes -
          Link This issue is related too HADOOP-6762 [ HADOOP-6762 ]
          Gavin made changes -
          Link This issue is related to HADOOP-6762 [ HADOOP-6762 ]
          Gavin made changes -
          Link This issue is related to HADOOP-6762 [ HADOOP-6762 ]


            • Assignee:
              Hari Shreedharan
            • Votes:
              0 Vote for this issue
              13 Start watching this issue


              • Created: