Elasticsearch Java transport client: exception caught on transport layer and reports no node available


(Yanke Guo) #1

Seems like something went wrong during ping and the client thinks the node is not available.

I've tried sniff on/off, latest version of elasticsearch client and various versions of Netty library.

java code:

// create the client
        TransportClient client = new PreBuiltTransportClient(
                Settings.builder()
                        .put("client.transport.sniff", true)
                        .put("client.transport.ignore_cluster_name", true)
                        .build()
        );
        for (String host : this.options.getHosts()) {
            InetSocketAddress address = InetSocketAddresses.from(host, 9300);
            if (address != null) {
                client = client.addTransportAddress(new TransportAddress(address));
            }
        }

Java version:

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

ElasticSearch client version:

org.elasticsearch.client:transport-6.3.2

Log:

20:44:19.147 [elasticsearch[_client_][generic][T#1]] WARN org.elasticsearch.transport.netty4.Netty4Transport - exception caught on transport layer [NettyTcpChannel{localAddress=0.0.0.0/0.0.0.0:58688, remoteAddress=null}], closing connection
java.lang.IllegalArgumentException: maxNumComponents: 1 (expected: >= 2)
        at io.netty.buffer.CompositeByteBuf.<init>(CompositeByteBuf.java:68)
        at io.netty.buffer.CompositeByteBuf.<init>(CompositeByteBuf.java:78)
        at io.netty.buffer.Unpooled.compositeBuffer(Unpooled.java:351)
        at org.elasticsearch.transport.netty4.Netty4Utils.toByteBuf(Netty4Utils.java:117)
        at org.elasticsearch.transport.netty4.NettyTcpChannel.sendMessage(NettyTcpChannel.java:98)
        at org.elasticsearch.transport.TcpTransport.internalSendMessage(TcpTransport.java:1138)
        at org.elasticsearch.transport.TcpTransport.access$800(TcpTransport.java:123)
        at org.elasticsearch.transport.TcpTransport$ScheduledPing.doRunInLifecycle(TcpTransport.java:363)
        at org.elasticsearch.common.util.concurrent.AbstractLifecycleRunnable.doRun(AbstractLifecycleRunnable.java:67)
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:725)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)