Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch key value: An existing connection was forcibly closed by the remote host #79

Open
crazyliuzc opened this issue Sep 24, 2020 · 0 comments
Labels

Comments

@crazyliuzc
Copy link

Version

3.9.3

Context

I encountered an exception which looks suspicious while ...

        Vertx vertx = Vertx.vertx();
        ConsulClientOptions options = new ConsulClientOptions()
                .setHost("192.168.6.107")
                .setPort(8500)
                .setTimeout(50000)
                .setLogActivity(false);
        for (int i = 0; i < 300; i++) {
            final int finalI = i;
            Watch<KeyValue> watch = Watch.key("test123"+i, vertx, options);
            watch.setHandler(keyValueWatchResult -> {
                if (keyValueWatchResult.succeeded()) {
                    KeyValue keyValue = keyValueWatchResult.nextResult();
                    log.info("{} Monitor timer:{}",finalI,keyValue.toJson().encodePrettily());
                } else {
                    log.error(finalI+" watch error" ,keyValueWatchResult.cause());
                    watch.stop();
                }
            }).start();
        }

I set timeout for a request is 50s. Start the Watch 300 times, some success, some error. This is error:

 java.io.IOException: An existing connection was forcibly closed by the remote host
	at sun.nio.ch.SocketDispatcher.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:192)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:377)
	at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1133)
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:821)

Do you have a reproducer?

https://github.com/crazyliuzc/test-vertx-consul

Extra

  • windows10,openjdk1.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant