We have an application based on Quarkus (2.4.2), and its mailsender is Vert.x Mailer. Config used:
quarkus.mailer.host=smtp.office365.com quarkus.mailer.keep-alive-timeout=PT60S quarkus.mailer.keep-alive=true
The issue we are having is that 60 seconds after a mail is sent the following is logged:
2021-11-25T09:48:58.477+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)
Based on this stacktrace it looks like it is smtp.office365.com that do Connection reset
, timeout handling in Vert.x’ SMTPConnection should close gracefully.
Does anyone have any experiences like this?
Silencing logging for SMTPConnection is an option, but that does not seem right.
Advertisement
Answer
My interpretation after stepping through the code is that SMTPConnection.quitCloseConnection is missing a call for closing the actuall connection.
So QUIT
is sent, then the smtp-server sends connection reset
since the connection is not closed.
I created an issue in vert.x mail client.