java.lang.IllegalStateException:执行者在关闭Reactivemongo驱动程序时不接受任务

问题描述 投票:0回答:1

我使用的是reactivemongo 0.16.2,每次关闭驱动程序让app退出时,都会出现以下错误:

java.lang.IllegalStateException: executor not accepting a task
at reactivemongo.io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:60)
at reactivemongo.io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:200)
at reactivemongo.io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:49)
at reactivemongo.io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:188)
at reactivemongo.io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:174)
at reactivemongo.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
at reactivemongo.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)
at reactivemongo.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)
at reactivemongo.io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:103)
at reactivemongo.io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at reactivemongo.io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:978)
at reactivemongo.io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:512)
at reactivemongo.io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:423)
at reactivemongo.io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:482)
at reactivemongo.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at reactivemongo.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at reactivemongo.io.netty.channel.kqueue.KQueueEventLoop.run(KQueueEventLoop.java:271)
at reactivemongo.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at reactivemongo.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)


22:35:22.023 [KQueueEventLoopGroup-2-1] DEBUG r.core.nodeset.ChannelFactory - [Supervisor-1/Connection-2] Connection to localhost:27017 refused for channel #c6beda17 java.lang.IllegalStateException: executor not accepting a task
at reactivemongo.io.netty.resolver.AddressResolverGroup.getResolver(AddressResolverGroup.java:60)
at reactivemongo.io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:200)
at reactivemongo.io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:49)
at reactivemongo.io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:188)
at reactivemongo.io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:174)
at reactivemongo.io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:511)
at reactivemongo.io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:485)
at reactivemongo.io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:424)
at reactivemongo.io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:103)
at reactivemongo.io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at reactivemongo.io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:978)
at reactivemongo.io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:512)
at reactivemongo.io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:423)
at reactivemongo.io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:482)
at reactivemongo.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at reactivemongo.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at reactivemongo.io.netty.channel.kqueue.KQueueEventLoop.run(KQueueEventLoop.java:271)
at reactivemongo.io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at reactivemongo.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)

我不明白它来自哪里。在我调用driver.close()之前,应用程序应该完成所有任务。我做错了什么,如何优雅地关闭驱动程序和所有连接?

mongodb netty reactivemongo
1个回答
0
投票

这似乎是mongodb驱动程序在关闭基础EventLoop之前没有正确等待所有任务完成。

© www.soinside.com 2019 - 2024. All rights reserved.