After 4.0.0 was released occasional failures started to appear in CI. I haven't been able to reproduce locally, but it's not too hard to spot stack traces like the following, pointing to the vertx.close(callback) hook:
[INFO] Running examples.ExamplesTest
Jan 21, 2021 9:40:19 AM io.netty.util.concurrent.DefaultPromise notifyListener0
WARNING: An exception was thrown by io.vertx.core.net.impl.TCPServerBase$$Lambda$576/0x00000008002f6040.operationComplete()
java.lang.IllegalStateException
at io.vertx.core.impl.CloseHooks.add(CloseHooks.java:48)
at io.vertx.core.impl.VertxImpl.addCloseHook(VertxImpl.java:1149)
at io.vertx.core.impl.ContextImpl.addCloseHook(ContextImpl.java:110)
at io.vertx.core.impl.EventLoopContext.addCloseHook(EventLoopContext.java:24)
at io.vertx.core.net.impl.TCPServerBase.lambda$listen$0(TCPServerBase.java:140)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:570)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:549)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:604)
at io.netty.util.concurrent.DefaultPromise.setSuccess(DefaultPromise.java:96)
at io.vertx.core.net.impl.AsyncResolveConnectHelper.lambda$null$1(AsyncResolveConnectHelper.java:61)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:577)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:551)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:490)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:615)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:604)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:104)
at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:989)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:566)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:248)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasksFrom(SingleThreadEventExecutor.java:428)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:377)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:488)
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.base/java.lang.Thread.run(Thread.java:834)
After 4.0.0 was released occasional failures started to appear in CI. I haven't been able to reproduce locally, but it's not too hard to spot stack traces like the following, pointing to the
vertx.close(callback)
hook: