MongoError['No primary node is available!']

1,304 views
Skip to first unread message

Ori Popowski

unread,
Jun 2, 2016, 3:57:25 PM6/2/16
to ReactiveMongo - http://reactivemongo.org
Hello,

We're using ReactiveMongo 0.11.11 with Play 2.4 (play2-reactivemongo:0.11.11-play24), and a single-node MongoDB 3.2.4.

The driver generally works fine, but very often there are MongoError['No primary node is available!'] errors, and the app is completely unusable.

We are due production release and this issue is very critical.

This is the complete stacktrace:

ERROR 15:30:31.484 [application-akka.actor.default-dispatcher-376] - reactivemongo.api.Failover2 - Got an error, no more attempts to do. Completing with a failure...
reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
    at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.<clinit>(actors.scala) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:757) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:757) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at scala.Option.getOrElse(Option.scala:121) ~[org.scala-lang.scala-library-2.11.8.jar:na]
    at reactivemongo.core.actors.MongoDBSystem$class.reactivemongo$core$actors$MongoDBSystem$$pickChannel(actors.scala:757) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$4.applyOrElse(actors.scala:365) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170) ~[org.scala-lang.scala-library-2.11.8.jar:na]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:482) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at reactivemongo.core.actors.LegacyDBSystem.aroundReceive(actors.scala:886) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at akka.actor.ActorCell.invoke(ActorCell.scala:495) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at akka.dispatch.Mailbox.run(Mailbox.scala:224) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at akka.dispatch.Mailbox.exec(Mailbox.scala:234) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [org.scala-lang.scala-library-2.11.8.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [org.scala-lang.scala-library-2.11.8.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [org.scala-lang.scala-library-2.11.8.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [org.scala-lang.scala-library-2.11.8.jar:na]
ERROR 15:30:31.484 [application-akka.actor.default-dispatcher-376] - reactivemongo.api.Cursor - fails to send request
reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
    at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.<clinit>(actors.scala) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:757) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:757) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at scala.Option.getOrElse(Option.scala:121) ~[org.scala-lang.scala-library-2.11.8.jar:na]
    at reactivemongo.core.actors.MongoDBSystem$class.reactivemongo$core$actors$MongoDBSystem$$pickChannel(actors.scala:757) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$4.applyOrElse(actors.scala:365) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170) ~[org.scala-lang.scala-library-2.11.8.jar:na]
    at akka.actor.Actor$class.aroundReceive(Actor.scala:482) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at reactivemongo.core.actors.LegacyDBSystem.aroundReceive(actors.scala:886) ~[org.reactivemongo.reactivemongo_2.11-0.11.11.jar:0.11.11]
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at akka.actor.ActorCell.invoke(ActorCell.scala:495) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at akka.dispatch.Mailbox.run(Mailbox.scala:224) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at akka.dispatch.Mailbox.exec(Mailbox.scala:234) ~[com.typesafe.akka.akka-actor_2.11-2.4.3.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [org.scala-lang.scala-library-2.11.8.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [org.scala-lang.scala-library-2.11.8.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [org.scala-lang.scala-library-2.11.8.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [org.scala-lang.scala-library-2.11.8.jar:na]



Cédric Chantepie

unread,
Jun 3, 2016, 4:13:32 AM6/3/16
to ReactiveMongo - http://reactivemongo.org
I guess you are using connection(dbName) or connection.db(dbName), either from the driver itself or from the Play plugin.

As mentioned in some recent posts there, these functions will be deprecated because of such issue, and it's recommended you use connection.database(dbName) instead, which returns a Future[DefaultDB] to be composed with your ops.

Ori Popowski

unread,
Jun 3, 2016, 4:58:30 AM6/3/16
to reacti...@googlegroups.com
Yes, you are correct. I used Play's ReactiveMongoApi.db() instead of ReactiveMongoApi.database().

This is very error prone since Play's plugin doesn't have a deprecated warning on that method (see here). I suggest doing it to prevent such problems in the future.

Anyway, I'll check if that solves the problem and will update.

Thank you very much!

On Fri, Jun 3, 2016 at 11:13 AM, Cédric Chantepie <chantep...@gmail.com> wrote:
I guess you are using connection(dbName) or connection.db(dbName), either from the driver itself or from the Play plugin.

As mentioned in some recent posts there, these functions will be deprecated because of such issue, and it's recommended you use connection.database(dbName) instead, which returns a Future[DefaultDB] to be composed with your ops.

--
You received this message because you are subscribed to a topic in the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/reactivemongo/eoCSJZ27Nzc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to reactivemong...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ori Popowski

unread,
Jun 3, 2016, 11:23:59 AM6/3/16
to reacti...@googlegroups.com
Yes, it solves the problem.

Just one thing which seems to be weird: I get lots of "ReactiveMongoApi starting..." messages (twice a minute). Is this normal? Does it have to do anything with the keepAlive flag being false by default?

Thanks

Cédric Chantepie

unread,
Jun 3, 2016, 11:39:27 AM6/3/16
to ReactiveMongo - http://reactivemongo.org
The message is misleading, it should be "Resolving database"
Reply all
Reply to author
Forward
0 new messages