Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-14771

RpcServer#getRemoteAddress always returns null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.0
    • 1.2.0, 1.3.0, 0.98.17, 2.0.0
    • IPC/RPC
    • None
    • Reviewed

    Description

      RpcServer.getRemoteAddress always returns null, because Call object is getting initialized with null.This seems to be happening because of using RpcServer.getRemoteIp() in Call object constructor before RpcServer thread local 'CurCall' being set in CallRunner.run method:

      // --- RpcServer.java ---
      protected void processRequest(byte[] buf) throws IOException, InterruptedException {
       .................................
      // Call object getting initialized here with address 
      // obtained from RpcServer.getRemoteIp()
      Call call = new Call(id, this.service, md, header, param, cellScanner, this, responder,
                    totalRequestSize, traceInfo, RpcServer.getRemoteIp());
        scheduler.dispatch(new CallRunner(RpcServer.this, call));
       }
      
      // getRemoteIp method gets address from threadlocal 'CurCall' which 
      // gets set in CallRunner.run and calling it before this as in above case, will return null
      // --- CallRunner.java ---
      public void run() {
        .........................   
        Pair<Message, CellScanner> resultPair = null;
        RpcServer.CurCall.set(call);
        ..............................
      }
      
      // Using 'this.addr' in place of getRemoteIp method in RpcServer.java seems to be fixing this issue
      Call call = new Call(id, this.service, md, header, param, cellScanner, this, responder,
                    totalRequestSize, traceInfo, this.addr);
      

      Attachments

        1. HBASE-14771-V2.patch
          7 kB
          Abhishek Kumar
        2. HBASE-14771-V1.patch
          4 kB
          Abhishek Kumar
        3. HBASE-14771-addendum-0.98.patch
          1 kB
          Andrew Kyle Purtell
        4. HBASE-14771.patch
          1 kB
          Abhishek Kumar
        5. 14771-V2.patch
          7 kB
          Ted Yu

        Activity

          People

            a72877 Abhishek Kumar
            a72877 Abhishek Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: