scala - Getting The entire node set is unreachable error when trying to connect to MongoDB with reactivemongo in my play2 application -


when working locally have no problem testing application calling:

http://localhost:9000/r/123 

method:

def showsurvey(id: string) = action {        implicit val reader = review.reviewreader     async {       val cursor = reviews.find(bsondocument("_id" -> bsonobjectid(id))).cursor[review]       cursor.headoption.map(maybereview =>         maybereview.map(review => {           // fill form           ok(views.html.review.desktopsurvey(some(id), surveyform.fill(surveyform(review.grade, review.text, regular_auth, false, "", "")), grades))         }           ).getorelse {           //notfound temporary below:       val review = review(some(new bsonobjectid(id)), 3, "bla", some(new datetime()), some(new datetime()), some("0.0.0.0"), reviewstatus.not_claimed, some(1), some(1l))       ok(views.html.review.desktopsurvey(some(id), surveyform.fill(surveyform(review.grade, review.text, regular_auth, false, "", "")), grades))      }       ).recover {         case e => internalservererror(e.getmessage())       }     }   } 

but when running app in production doing clean compile stage , going url get:

[error] r.c.a.mongodbsystem - entire node set unreachable, there network problem? 

i find strange since plugin seems work properly:

[info] application - reactivemongoplugin started db 'blala'! servers:         [87.238.57.140:27017] 

by checking mongodb log found connection ok bson sent in invalid:

tue may 21 11:18:11.257 [conn531] assertion: 10307:client error: bad object in message: invalid bson 0xdcf361 0xd90a1b 0xd90f5c 0x75b289 0x75b3fb 0x9f4367 0x9f57e2 0x6e747a 0xdbbb7e 0x7fa22e96d9ca 0x7fa22dd14cdd   /usr/bin/mongod(_zn5mongo15printstacktraceerso+0x21) [0xdcf361]  /usr/bin/mongod(_zn5mongo11msgassertedeipkc+0x9b) [0xd90a1b]  /usr/bin/mongod() [0xd90f5c]  /usr/bin/mongod(_zn5mongo9dbmessage9nextjsobjev+0x249) [0x75b289]  /usr/bin/mongod(_zn5mongo12querymessagec1erns_9dbmessagee+0x8b) [0x75b3fb]  /usr/bin/mongod() [0x9f4367]  /usr/bin/mongod(_zn5mongo16assembleresponseerns_7messageerns_10dbresponseerkns_11hostandporte+0x392) [0x9f57e2]  /usr/bin/mongod(_zn5mongo16mymessagehandler7processerns_7messageepns_21abstractmessagingportepns_9lasterrore+0x9a) [0x6e747a]  /usr/bin/mongod(_zn5mongo17portmessageserver17handleincomingmsgepv+0x42e) [0xdbbb7e]  /lib/libpthread.so.0(+0x69ca) [0x7fa22e96d9ca]  /lib/libc.so.6(clone+0x6d) [0x7fa22dd14cdd] tue may 21 11:18:11.261 [conn531] assertionexception handling request, closing client connection: 10307 client error: bad object in message: invalid bson 

this made me @ code , problem was sending in invalid objectid, in case 123 . somehow error got swallowed application. when there possibility objectid sent in might corrupt check with:

val maybeoid: try[bsonobjectid] = bsonobjectid.parse(id) if (maybeoid.issuccess) {     // stuff } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -