anmolnar commented on pull request #4125:
URL: https://github.com/apache/hbase/pull/4125#issuecomment-1074504042


   Okay, another round of investigation finished. I think I pinned down the 
issue:
   
   So, the problem is not the timing of the Netty pipeline become usable, 
because Netty already takes care of the write requests from this aspect. The 
root problem is that we're trying to send a Call, not a ByteBuf which has to be 
converted, so either the `BufferCallBeforeInitHandler` or the protobuf 
converter has to be on the pipeline before calling the write (and flush).
   
   This was the case previously, because a single channel handler 
(BufferCallBeforeInitHandler) was added in the connect() method which means 
it's immediately added to the pipeline. Now we need the SSL handler as well and 
this must be done via `ChannelInitializer` (HBaseClientPipelineFactory). As a 
consequence the channel pipeline will be built fully asynchronously by Netty 
and connect() method will only return a promise without building anything. 
We'll add the call to the "builder" pipeline which has the "head", "the 
pipeline factory" and the "tail". None of them takes care of the Call and fails.
   
   How to synchronize this?
   I see some options:
   
   1. Using the `sync()` method to force building the usable pipeline first.
   2. Add latch - ugly and same effect
   3. Try to upgrade Netty - HBase uses 4.0 which is quite old, maybe they're 
doing this better in a later version. I'll check.
   4. Put the `writeAndFlush()` operation in a channel promise callback to make 
sure it's only called when the pipeline is ready to use. This seems to me the 
most Netty-way resolution.


-- 
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