ClassNotFoundException
ClassNotFoundException

Reputation: 409

java.lang.IllegalStateException: executor not accepting a task When Closing Reactivemongo Driver

I am using reactivemongo 0.16.2 and each time I close the driver to let the app exit, I get the following error:

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)

I do not understand where it comes from. Before I call driver.close(), the app is supposed to finish all the tasks. What I am doing wrong and how can I close the driver and all connections gracefully?

Upvotes: 1

Views: 8575

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23567

This seems like the mongodb driver does not correctly wait for all tasks to complete before shutdown the underlying EventLoop.

Upvotes: 2

Related Questions