TransportClient hangs when in sniff mode and no node running #1818

Closed
jprante opened this Issue Mar 28, 2012 · 3 comments

Projects

None yet

2 participants

@jprante

When TransportClient is started in sniff mode, but no ES node is running at a single given transport address, only a "Connection refused" exception is silently logged at debug level. After that, TransportClient hangs in "addTransportAddress".

Code:

    Settings settings = ImmutableSettings.settingsBuilder()
            .put("cluster.name", "elasticsearch")
            .put("client.transport.sniff", true)
            .build();
    try {
        Client client = new TransportClient(settings);        
        client.addTransportAddress(address);
        client.close();
    } catch (Exception e) {
        logger.log(Level.WARNING, e.getMessage());            
    }

I expect a NoNodeAvailableException (or a MasterNotDiscoveredException?) instead.

Here is the debug level message.

[22:12:51,680][DEBUG][org.elasticsearch.client.transport] [Riot] failed to connect to node [[#transport#-1][inet[Jorg-Prantes-MacBook-Pro.local/192.168.1.113:9300]]], removed from nodes list
org.elasticsearch.transport.ConnectTransportException: [][inet[Jorg-Prantes-MacBook-Pro.local/192.168.1.113:9300]] connect_timeout[30s]
    at org.elasticsearch.transport.netty.NettyTransport.connectToChannels(NettyTransport.java:560)
    at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:503)
    at org.elasticsearch.transport.netty.NettyTransport.connectToNode(NettyTransport.java:482)
    at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:128)
    at org.elasticsearch.client.transport.TransportClientNodesService$SniffNodesSampler$1.run(TransportClientNodesService.java:327)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
    at org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.connect(NioClientSocketPipelineSink.java:400)
    at org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processSelectedKeys(NioClientSocketPipelineSink.java:362)
    at org.elasticsearch.common.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:284)
    at org.elasticsearch.common.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
    at org.elasticsearch.common.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    ... 3 more
@jprante

See also #1819

@kimchy
elastic member

Yes, seems like #1819 will fix it.

@kimchy
elastic member

Fixed in #1819.

@kimchy kimchy closed this Mar 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment