vert.x icon indicating copy to clipboard operation
vert.x copied to clipboard

With Netty Epoll throw readAddress(..) failed: Connection timed out

Open yuchen99 opened this issue 8 years ago • 5 comments

env

Java : 1.8.0_144 vertx: 3.5.0 with cluster manager Hazelcast netty: netty-all:4.1.19.Final os: ubuntu 16.04

I use vertx to create tcp server and set setPreferNativeTransport = true ,NetServerOptions

NetServerOptions ops = new NetServerOptions();
        ops.setReceiveBufferSize(32 * 1024)
                .setSendBufferSize(32 * 1024)
                .setIdleTimeout(timeoutSecond)
                .setPort(port)
                .setHost(host)
                .setTcpFastOpen(true)
                .setTcpQuickAck(true)
                .setUsePooledBuffers(true)
                .setTcpNoDelay(true);

client will send 3 kinds package

  1. < 38B every 1 second ,server just receive then send to kafka
  2. 1.2KB every 1 second ,server just receive then send to kafka
  3. heartbeat 35B every 5 seconds , server send ack
 log.info("write data to client...[{}]", StringUtil.toHexString(cmd.getBytes()));
        if (Objects.isNull(client)) {
            return false;
        }
        client.write(cmd);
        if (client.writeQueueFull()) {
            client.pause();
            client.drainHandler(done -> client.resume());
        }

with 1000 clients after a few hours netty will throw readAddress(..) failed: Connection timed out

2018-02-01 07:36:59,545 [ERROR] [vert.x-eventloop-thread-9] 
DataHubBroker [DataHubBroker.java : 154] device error io.netty.channel.unix.Errors$NativeIoException: readAddress(..) failed: Connection timed out
 at io.netty.channel.unix.Errors.newIOException(Errors.java:122)
 at io.netty.channel.unix.Errors.ioResult(Errors.java:146)
 at io.netty.channel.unix.FileDescriptor.readAddress(FileDescriptor.java:178)
 at io.netty.channel.epoll.AbstractEpollChannel.doReadBytes(AbstractEpollChannel.java:347)
 at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:786)
 at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:404)
 at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:304)
 at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
 at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 at java.lang.Thread.run(Thread.java:748)

I find netty issues.but it close at 4.0.26 .Any ideas for help?

yuchen99 avatar Feb 01 '18 04:02 yuchen99

you should use netty-all:4.1.15.Final with 3.5.0

vietj avatar Feb 01 '18 07:02 vietj

I also use redisson too. it require Netty 4.1.19. when setPreferNativeTransport = false it works .I don't why

yuchen99 avatar Feb 02 '18 04:02 yuchen99

do you have a good reason to prefer native transport over java NIO ?

vietj avatar Feb 02 '18 06:02 vietj

imho it looks like more a Netty issue than a Vert.x issue

vietj avatar Feb 02 '18 06:02 vietj

just see vertx support native transport and want to try....

yuchen99 avatar Feb 05 '18 02:02 yuchen99