简体   繁体   中英

ElasticSearch Java TransportClient leaking byte[]

ElasticSearch Java TransportClient 5.5.1 seems to be leaking byte arrays. Even if i just connect and close, commenting the code in between, it leaks.

The code:

try (PreBuiltTransportClient preBuiltTransportClient = new PreBuiltTransportClient(settings)) {
     try(TransportClient transportClient=preBuiltTransportClient.addTransportAddress(
            new InetSocketTransportAddress(InetAddress.getByName(endPoint),javaPort))){
         //do something
     }
}

Plugin loading log (may indicate something):

加载插件日志 VisualVM Heap dump showing byte[] allocated size on the heap (after forcing a garbage collection):

VisualVM的

Seems to be the same problem as posted here: https://discuss.elastic.co/t/are-there-memory-leaks-in-elasticsearchs-transportclient-5-4-3-or-is-my-code-flawed/91989/5

Not sure if relevant, but I am using Spring boot on the same project.

Any ideas?

EDIT:

Seems to be related to Compression:

在此输入图像描述

EDIT2:

The memory consumption increases greatly on TransportClientNodesService.addTransportAddresses

Solution here: https://github.com/elastic/elasticsearch/issues/26048

It's not a leak, it's from netty pooled allocator.

Set io.netty.allocator.type=unpooled to disable.

System.setProperty("io.netty.allocator.type", "unpooled");

OR

-Dio.netty.allocator.type=unpooled 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM