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

Xiaobing Zhou commented on HBASE-18078:
---------------------------------------

Posted v0 patch to handle connection related issues, such as timeout.

The idea is to catch and propagate ConnectionException up. Therefore, from 
bottom of stack, whatever issues from establishing connection (i.e. Wangle 
pipeline) will be folly::AsyncSocketException wrapped within 
ConnectionException.

Note that there's no way to set socket options in Wangle ClientBootstrap, but 
fortunately, ClientBootstrap::connect supports setting our own timeout which is 
enough for now.

See also ConnectionFactory::Connect
{code}
try {
          /* any connection error (e.g. timeout) will be 
folly::AsyncSocketException */
    auto pipeline = client->connect(
        SocketAddress(hostname, port, true),
        std::chrono::duration_cast<milliseconds>(connect_timeout_)).get();
    auto dispatcher = std::make_shared<ClientDispatcher>();
    dispatcher->setPipeline(pipeline);
    promise.setValue(dispatcher);
        } catch(const folly::AsyncSocketException &e) {
          promise.setException(
              folly::make_exception_wrapper<hbase::ConnectionException>(
                  
folly::make_exception_wrapper<folly::AsyncSocketException>(e)));
        }
{code}


> [C++] Harden RPC by handling various communication abnormalities
> ----------------------------------------------------------------
>
>                 Key: HBASE-18078
>                 URL: https://issues.apache.org/jira/browse/HBASE-18078
>             Project: HBase
>          Issue Type: Sub-task
>            Reporter: Xiaobing Zhou
>            Assignee: Xiaobing Zhou
>         Attachments: HBASE-18078.000.patch
>
>
> RPC layer should handle various communication abnormalities (e.g. connection 
> timeout, server aborted connection, and so on). Ideally, the corresponding 
> exceptions should be raised and propagated through handlers of pipeline in 
> client.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to