Vert.x 邮件发送器的连接重置保持活动超时

Connection Reset for Vert.x mailsender on keep alive timeout

我们有一个基于 Quarkus (2.4.2) 的应用程序,它的邮件发送器是 Vert.x Mailer。 使用的配置:

quarkus.mailer.host=smtp.office365.com
quarkus.mailer.keep-alive-timeout=PT60S
quarkus.mailer.keep-alive=true

我们遇到的问题是在发送邮件 60 秒后会记录以下内容:

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.run(SingleThreadEventExecutor.java:986)
        at io.netty.util.internal.ThreadExecutorMap.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.run(SingleThreadEventExecutor.java:986)
        at io.netty.util.internal.ThreadExecutorMap.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:832)

基于此堆栈跟踪,它看起来像是 smtp.office365.com 执行 Connection reset,在 Vert.x' SMTPConnection should close gracefully.

中进行超时处理

有没有人有过这样的经历?

沉默 SMTPConnection 的日志记录是一个选项,但这似乎不正确。

我单步执行代码后的解释是 SMTPConnection.quitCloseConnection 缺少关闭实际连接的调用。

所以 QUIT 被发送,然后 smtp-server 发送 connection reset 因为连接没有关闭。

我在 vert.x mail client 中创建了一个问题。