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

时间:2019-02-18 07:25:32

标签: mongodb netty reactivemongo

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

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()之前,该应用程序应该完成所有任务。我在做错什么,如何才能正常关闭驱动程序和所有连接?

1 个答案:

答案 0 :(得分:0)

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