Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-11235

Elasticsearch connector leaks threads if no connection could be established

    XMLWordPrintableJSON

Details

    Description

      elasticsearch transport sink init steps

      1, create client thread

      2, try to check every host:port

      3, if each host:port is unreachable, while throw RuntimeException

      but, because of throw RuntimeException, the client can not close, so causing thread leak

      transport client code

      ```

      TransportClient transportClient = new PreBuiltTransportClient(settings);
      for (TransportAddress transport : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses))

      { transportClient.addTransportAddress(transport); }

      // verify that we actually are connected to a clusterif (transportClient.connectedNodes().isEmpty()) {
      throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!");
      }

      return transportClient;
      }

      ```

      thread leak

      thread dump

       

      Attachments

        1. image-2018-12-31-22-31-53-635.png
          17 kB
          lamber-ken
        2. image-2018-12-31-22-31-19-081.png
          12 kB
          lamber-ken

        Issue Links

          Activity

            People

              lamber-ken lamber-ken
              lamber-ken lamber-ken
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m