[ 
https://issues.apache.org/jira/browse/FLINK-11235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chesnay Schepler closed FLINK-11235.
------------------------------------
    Resolution: Fixed

master: 4febcdc289bc0dce1090d831c7f99848a26f6465
1.7: 5ac632cf63098bb5f1c3692fec59a89a48534ea5
1.6: 1702c9902c9e03e98473035bf82f4b07fffa3bb6

> Elasticsearch connector leaks threads if no connection could be established
> ---------------------------------------------------------------------------
>
>                 Key: FLINK-11235
>                 URL: https://issues.apache.org/jira/browse/FLINK-11235
>             Project: Flink
>          Issue Type: Bug
>          Components: ElasticSearch Connector
>    Affects Versions: 1.6.3, 1.7.1, 1.8.0
>            Reporter: lamber-ken
>            Assignee: lamber-ken
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.6.4, 1.7.2, 1.8.0
>
>         Attachments: image-2018-12-31-22-31-19-081.png, 
> image-2018-12-31-22-31-53-635.png
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> h2. *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{color:#FF0000}, the client can not 
> close{color}, so causing thread leak
> h2. *transport client code*
> ```
> TransportClient transportClient = {color:#000080}new 
> {color}PreBuiltTransportClient(settings);
> {color:#000080}for {color}(TransportAddress transport : 
> ElasticsearchUtils.convertInetSocketAddresses({color:#660e7a}transportAddresses{color}))
>  {
>  transportClient.addTransportAddress(transport);
> }
> {color:#808080}// verify that we actually are connected to a cluster
> {color}{color:#000080}if {color}(transportClient.connectedNodes().isEmpty()) {
>  {color:#000080}throw new 
> {color}RuntimeException({color:#008000}"Elasticsearch client is not connected 
> to any Elasticsearch nodes!"{color});
> }
> {color:#000080}return {color}transportClient;
> }
> ```
> h2. *thread leak*
> *!image-2018-12-31-22-31-19-081.png!*
> h2. *thread dump*
> !image-2018-12-31-22-31-53-635.png!
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to