anmolnar commented on a change in pull request #4125:
URL: https://github.com/apache/hbase/pull/4125#discussion_r829044839



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcConnection.java
##########
@@ -297,11 +295,10 @@ public void operationComplete(ChannelFuture future) 
throws Exception {
             established(ch);
           }
         }
-      }).channel();
+      }).sync().channel();

Review comment:
       HBase shell is not able to connect without this. I'm sure I've seen 
errors in RS-Master communication as well, but it works in most cases.
   
   The issue is:
   ```
   ERROR: Failed contacting masters after 1 attempts.
   Exceptions:
   java.io.IOException: Call to address=Andors-MacBook-Pro.local:16000 failed 
on local exception: java.io.IOException: 
java.lang.UnsupportedOperationException: unsupported message type: Call 
(expected: ByteBuf, FileRegion)
   ```
   
   My thinking is that `connect()` is having a race with `sendRequest()`, 
becaue NettyRpcConnection is trying to establish the connection in lazy way: 
doesn't do anything until the first request (`Call`) comes in. Because of this 
we have to make sure that the Netty pipeline is in a usable state before 
letting sendRequest() to push the Call into and seems like `sync()` is enough. 
It waits for the connection to be established before we give back the channel.
   
   This is still not ideal IMHO: we could implement a latch to wait for the SSL 
handshake to happen before doing anything else - like ZooKeeper does -, but it 
might be overkill in this case given that it already works fine with sync().




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to