Error messages during Java NIO shutdown - avoidable?

249 views
Skip to first unread message

Jim Talbut

unread,
Oct 20, 2021, 2:59:50 AM10/20/21
to rabbitmq-users
Hi,
I have a Java rabbitmq client that is generating WARN and ERROR level log messages when I try to shut it down.
Can these be avoided?
[rabbitmq-connection-shutdown-amqp://gu...@127.0.0.1:19943/] INFO io.vertx.rabbitmq.impl.RabbitMQConnectionImpl - Connection Shutdown: clean connection shutdown; protocol method: #method<connection.close>(reply-code=200, reply-text=OK, class-id=0, method-id=0)
[rabbitmq-nio] WARN com.rabbitmq.client.impl.nio.NioLoop - Error during reading frames
java.io.IOException: I/O thread: reached EOF
at com.rabbitmq.client.impl.nio.NioHelper.read(NioHelper.java:27)
at com.rabbitmq.client.impl.nio.SocketChannelFrameHandlerState.prepareForReadSequence(SocketChannelFrameHandlerState.java:189)
at com.rabbitmq.client.impl.nio.NioLoop.run(NioLoop.java:153)
at java.base/java.lang.Thread.run(Thread.java:831)
[rabbitmq-connection-shutdown-amqp://gu...@127.0.0.1:19943/] ERROR com.rabbitmq.client.impl.ForgivingExceptionHandler - An unexpected connection driver error occurred
java.io.IOException: I/O thread: reached EOF
at com.rabbitmq.client.impl.nio.NioHelper.read(NioHelper.java:27)
at com.rabbitmq.client.impl.nio.SocketChannelFrameHandlerState.prepareForReadSequence(SocketChannelFrameHandlerState.java:189)
at com.rabbitmq.client.impl.nio.NioLoop.run(NioLoop.java:153)
at java.base/java.lang.Thread.run(Thread.java:831)
[rabbitmq-connection-shutdown-amqp://gu...@127.0.0.1:19943/] INFO io.vertx.rabbitmq.impl.RabbitMQConnectionImpl - Connection Shutdown: connection error

The first line is from my ShutdownListener and is expected.
The next two seem to originate from here: https://github.com/rabbitmq/rabbitmq-java-client/blob/main/src/main/java/com/rabbitmq/client/impl/nio/NioHelper.java

Note that I am running the connection through a Vertx proxy, but that should only be closing sockets in response to them being closed by the other end.
The relevant proxy code is just:
          serverSocket.handler(clientSocket::write);
          serverSocket.exceptionHandler(err -> serverSocket.close());
          serverSocket.closeHandler(v -> clientSocket.close());
          clientSocket.handler(serverSocket::write);
          clientSocket.exceptionHandler(err -> clientSocket.close());
          clientSocket.closeHandler(v -> serverSocket.close());
          serverSocket.resume();

Thanks.

Jim

Arnaud Cogoluègnes

unread,
Oct 20, 2021, 10:02:10 AM10/20/21
to rabbitmq-users
There should be no exception on a proper shutdown. Can you provide an example to reproduce?

Jim Talbut

unread,
Oct 21, 2021, 3:29:41 AM10/21/21
to rabbitmq-users
Thanks for clarifying, on further digging it was my fault.

The point of my code was to test some logic around reconnecting (covering some cases that the client library recovery does not) and a race condition was causing me to create two connections and then forget one of them!

Arnaud Cogoluègnes

unread,
Oct 21, 2021, 8:44:47 AM10/21/21
to rabbitmq-users
Glad you found the cause of the problem and thanks for reporting back on the mailing list.
Reply all
Reply to author
Forward
0 new messages