You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using connection pooling with smtp.office365.com an error is logged every time a connection has reached keep alive-timeout.
(if timeout is set to 60 seconds, the error is printed ~60s after last email is sent)
2021-11-29T11:09:49.252+0100 ERROR [vert.x-eventloop-thread-2] io.vertx.ext.mail.impl.SMTPConnection Connection reset: java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:367)
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:398)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:832)
: java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:367)
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:398)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:253)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:350)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:832)
So my interpretation is that calling shutdown() is missing in quitCloseConnection. If I call shutdown() after QUIT i sent the connection reset does not happen.
I can reproduce the error logging, and it seems the smtp server does reply on the QUIT command with 221 2.0.0 Service closing transmission channel, so it is fine.
For some reason, the exceptionHandler of the underline NetSocket gets called after the client gets the response, that is where the error logging comes from.
I see [RST, ACK] sequence in Wireshark, which indicates that the smtp server does not close the connection gracefully. I don't see this error logging with local Apache James server setup, it closes the connection gracefully with [FIN, ACK] flags.
I don't see much we can do in mail client side except ignoring the exception if QUIT has been sent to smtp server.
Version
Vert.x mail-client 4.2.1, Quarkus 2.5.0
Context
When using connection pooling with smtp.office365.com an error is logged every time a connection has reached keep alive-timeout.
(if timeout is set to 60 seconds, the error is printed ~60s after last email is sent)
With debug logging:
Stepping though SMTPConnection.quitCloseConnection I can see that
QUIT
is sent, but the connection is not closed.The javadoc for
quitCloseConnection
saysSo my interpretation is that calling
shutdown()
is missing inquitCloseConnection
. If I callshutdown()
afterQUIT
i sent the connection reset does not happen.Do you have a reproducer?
https://github.com/computerlove/mailer-reproducer
Steps to reproduce
ERROR Connection reset
should be logged.The text was updated successfully, but these errors were encountered: