sgodbillon / reactivemongo-tailablecursor-demo

Tailable Cursors through WebSockets with ReactiveMongo and Play 2.0
62 stars 21 forks source link

The entire node set is unreachable #3

Closed neyarangeshk closed 11 years ago

neyarangeshk commented 11 years ago

When the application loads, these are the lines displayed on the MS-DOS prompt:

[localhost] [info] play - Application started (Dev) [error] MongoDBSystem - The entire node set is unreachable, is there a network problem? [error] MongoDBSystem - The entire node set is unreachable, is there a network problem?

However, upon visiting http;//localhost:9000/ , The application displays fine, unless you create an article, where an error is displayed:

Execution exception [ArrayIndexOutOfBoundsException: 0] In C:\test\app\models\articles.scala at line 39. 35 } 36 implicit object ArticleBSONWriter extends BSONWriter[Article] { 37 def toBSON(article: Article) = { 38 val bson = BSONDocument( 39 "_id" -> article.id.getOrElse(BSONObjectID.generate), 40 "title" -> BSONString(article.title), 41 "content" -> BSONString(article.content), 42 "publisher" -> BSONString(article.publisher)) 43 if(article.creationDate.isDefined)

Hope this helps. I keep coming back to reactive mongo even after trying Salat, etc. only because it looks robust...any help is much appreciated. Thanks!

sgodbillon commented 11 years ago

Hi,

Can you tell me which version of MongoDB you work with? And if you have a more detailed stack trace, that would be useful ;)

About the first error, that is actually a log that you can safely ignore. This will be fixed soon.

Thank you for you report!

neyarangeshk commented 11 years ago

Thanks for the prompt reply Stephane,

My MongoDB version is 2.0.6

And sorry, seems like I opened the ticket in the wrong project. I actually got these errors in the demo-app, and not on the tailable cursor demo:

https://github.com/sgodbillon/reactivemongo-demo-app

Here's the detailed stack trace:

(Server started, use Ctrl+D to stop and go back to the console...)

[info] Compiling 7 Scala sources and 1 Java source to C:\test\play\demo
app\target\scala-2.9.2\classes...
[info] application - ReactiveMongoPlugin starting...
[info] application - ReactiveMongoPlugin successfully started with db 'app'! Ser
vers:
                [localhost]
[info] play - Application started (Dev)
[error] MongoDBSystem - The entire node set is unreachable, is there a network p
roblem?
[error] MongoDBSystem - The entire node set is unreachable, is there a network p
roblem?
[error] play - Cannot invoke the action, eventually got an error: java.lang.Arra
yIndexOutOfBoundsException: 0
[error] application -

! @6c4im5a11 - Internal server error, for (POST) [/articles/new] ->

play.api.Application$$anon$1: Execution exception [[ArrayIndexOutOfBoundsExcepti
on: 0]]
        at play.api.Application.handleError(Application.scala:144) ~[play_2.9.2.
jar:2.1-SNAPSHOT]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$handleActi
on$1$4$$anonfun$apply$31.apply(PlayDefaultUpstreamHandler.scala:367) [play_2.9.2
.jar:2.1-SNAPSHOT]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$handleActi
on$1$4$$anonfun$apply$31.apply(PlayDefaultUpstreamHandler.scala:367) [play_2.9.2
.jar:2.1-SNAPSHOT]
        at scala.Option.map(Option.scala:133) [scala-library.jar:0.12.0]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$handleActi
on$1$4.apply(PlayDefaultUpstreamHandler.scala:367) [play_2.9.2.jar:2.1-SNAPSHOT]

        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$handleActi
on$1$4.apply(PlayDefaultUpstreamHandler.scala:362) [play_2.9.2.jar:2.1-SNAPSHOT]

Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
        at reactivemongo.bson.BSONObjectID$.generate(bson.scala:396) ~[reactivem
ongo_2.9.2-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
        at models.Article$ArticleBSONWriter$$anonfun$1.apply(articles.scala:39)
~[na:na]
        at models.Article$ArticleBSONWriter$$anonfun$1.apply(articles.scala:39)
~[na:na]
        at scala.Option.getOrElse(Option.scala:108) [scala-library.jar:0.12.0]
        at models.Article$ArticleBSONWriter$.toBSON(articles.scala:39) ~[na:na]
        at models.Article$ArticleBSONWriter$.toBSON(articles.scala:36) ~[na:na]

Hope this helps,

Thanks!

sgodbillon commented 11 years ago

Ok, I see the problem. I just updated the repository with a jar containing the bugfix, can you try again with it?

neyarangeshk commented 11 years ago

Fixed! Thanks :) Just curious, how long till I can use this for production, Stephane? Or can I use it already ? :)

sgodbillon commented 11 years ago

You're welcome ;)

It's still under development, but the core is solid. The API may change a bit until the release though. I think it depends on your project ;)

manland commented 11 years ago

Hello,

I have the same problem. I use last reactivemongo :

val appDependencies = Seq(
  "play.modules.reactivemongo" %% "play2-reactivemongo" % "0.1-SNAPSHOT" changing()
)

with mongo 2.0.7 and 2.2.1, and of course with the special play-2.1 snapshot.

Stacktrace :

DefaultBSONElement(id,BSONString(41b115f5-017f-42d4-a348-5f0a72664d92))
[warn] Failover - Got an error, retrying... (try #1 is scheduled in 500 ms)
reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
    at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.<clinit>(actors.scala) ~[reactivemongo_2.9.2-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$pickChannel$6.apply(actors.scala:383) ~[reactivemongo_2.9.2-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$pickChannel$6.apply(actors.scala:383) ~[reactivemongo_2.9.2-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at scala.Option.toRight(Option.scala:241) ~[scala-library.jar:0.12.0]
    at reactivemongo.core.actors.MongoDBSystem.pickChannel(actors.scala:383) ~[reactivemongo_2.9.2-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
    at reactivemongo.core.actors.MongoDBSystem$$anonfun$receive$1.apply(actors.scala:173) ~[reactivemongo_2.9.2-0.1-SNAPSHOT.jar:0.1-SNAPSHOT]
[info] MongoDBSystem - [Init] Init is done
[error] MongoDBSystem - The entire node set is unreachable, is there a network problem?
[error] MongoDBSystem - The entire node set is unreachable, is there a network problem?
[error] application - Mongo LastErorr : reactivemongo.core.commands.LastError: MongoError['empty lastError message']
Right(())

Any idea ? Thx for your help

manland commented 11 years ago

Meaculpa, it's ok with :

val appDependencies = Seq(
  "reactivemongo" %% "reactivemongo" % "0.1-SNAPSHOT",
  "play.modules.reactivemongo" %% "play2-reactivemongo" % "0.1-SNAPSHOT"
)
val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
  resolvers += "sgodbillon" at "https://bitbucket.org/sgodbillon/repository/raw/master/snapshots/"
)
mongodb.servers = ["127.0.0.1:27017"] //or url:port of your mongodb instance
mongodb.db = "nameDb"

For neebies, like me, just copy/paste this project instead readme.md of reactivemongo !

If you have already test reactivemongo, make a "play clean update eclipse" (maybe all commands aren't necessary ?) to reload jar. If doens't work, add "changing()" after dependencies in build.scala and run "play update".

dev-inigmas commented 11 years ago

Does ReactiveMongo only work with MongoDB 2.2.1? I'm asking because I'm currently running 2.0.4 on my development computer and I keep getting the "The entire node set is unreachable, is there a network problem?" error. Other than the MongoDB version everything else seems to be setup correctly.

I could upgrade my version of MongoDB to experiment, but it seems as though MongoLabs is only providing version "2.0.7" at the moment. So if this driver doesn't work with older versions of MongoDB then I can't seem to use it.

Thanks.

sgodbillon commented 11 years ago

Hi,

No, it works and is tested on 2.0 as well. The message you see is not meaningful when ReactiveMongo starts. I'm currently working to delete this annoying log on the startup. But it should not prevent you to run the app.

sgodbillon commented 11 years ago

Hi,

Just to tell that this message does not show up anymore when ReactiveMongo starts :)