Uploaded image for project: 'Flume'
  1. Flume
  2. FLUME-1306

LoadBalancingRpcClient should catch exception for invalid RpcClient and failover to valid one

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.2.0
    • None

    Description

      It appears from test that if we provide invalid host address as one of the host address in the host list, LoadBalancingRpcClient should catch exception for invalid RpcClient and failover to next in the host list.

      ERROR org.apache.flume.api.NettyAvroRpcClient  - RPC connection error :
      java.io.IOException: Error connecting to xxxxx-xxxxx.xxxx.xxxxx.xxxx:xxxx
              at org.apache.avro.ipc.NettyTransceiver.getChannel(NettyTransceiver.java:249)
              at org.apache.avro.ipc.NettyTransceiver.<init>(NettyTransceiver.java:198)
              at org.apache.avro.ipc.NettyTransceiver.<init>(NettyTransceiver.java:147)
              at org.apache.flume.api.NettyAvroRpcClient.connect(NettyAvroRpcClient.java:118)
              at org.apache.flume.api.NettyAvroRpcClient.connect(NettyAvroRpcClient.java:107)
              at org.apache.flume.api.NettyAvroRpcClient.configure(NettyAvroRpcClient.java:446)
              at org.apache.flume.api.RpcClientFactory.getInstance(RpcClientFactory.java:83)
              at org.apache.flume.api.LoadBalancingRpcClient.createClient(LoadBalancingRpcClient.java:190)
              at org.apache.flume.api.LoadBalancingRpcClient.getClient(LoadBalancingRpcClient.java:173)
              at org.apache.flume.api.LoadBalancingRpcClient.append(LoadBalancingRpcClient.java:69)
      

      The proposed fix would be moving RpcClient client = getClient(host) inside try block

      @Override
        public void append(Event event) throws EventDeliveryException {
          boolean eventSent = false;
          Iterator<HostInfo> it = selector.createHostIterator();
      
          while (it.hasNext()) {
            HostInfo host = it.next();
            try {
              RpcClient client = getClient(host);
              client.append(event);
              eventSent = true;
              break;
            } catch (Exception ex) {
              LOGGER.warn("Failed to send event to host " + host, ex);
            }
          }
      
          if (!eventSent) {
            throw new EventDeliveryException("Unable to send event to any host");
          }
        }
      

      Attachments

        1. FLUME-1306.trunk.v1.patch
          0.6 kB
          Mubarak Seyed

        Activity

          People

            mubarakseyed Mubarak Seyed
            mubarakseyed Mubarak Seyed
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: