I am using mongohq as a heroku add on, and I have recently encountered some problems running my app on my local host. I keep getting the following stack trace as soon as my app tries to go to the database.
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[Network: can't call something : staff.mongohq.com/50.17.135.240:10050/app4620908]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:82) [play_2.9.1.jar:2.0]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:63) [play_2.9.1.jar:2.0]
at akka.actor.Actor$class.apply(Actor.scala:290) [akka-actor.jar:2.0]
at play.core.ActionInvoker.apply(Invoker.scala:61) [play_2.9.1.jar:2.0]
at akka.actor.ActorCell.invoke(ActorCell.scala:617) [akka-actor.jar:2.0]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:179) [akka-actor.jar:2.0]
Caused by: com.mongodb.MongoException$Network: can't call something : staff.mongohq.com/50.17.135.240:10050/app4620908
at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:227) ~[mongo-java-driver-2.7.3.jar:na]
at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305) ~[mongo-java-driver-2.7.3.jar:na]
at com.mongodb.DB.command(DB.java:160) ~[mongo-java-driver-2.7.3.jar:na]
at com.mongodb.DB.command(DB.java:183) ~[mongo-java-driver-2.7.3.jar:na]
at com.mongodb.DBCollection.getCount(DBCollection.java:864) ~[mongo-java-driver-2.7.3.jar:na]
at com.mongodb.DBCollection.getCount(DBCollection.java:835) ~[mongo-java-driver-2.7.3.jar:na]
Caused by: java.net.SocketException: Operation timed out
at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.6.0_31]
at java.net.SocketInputStream.read(SocketInputStream.java:129) ~[na:1.6.0_31]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) ~[na:1.6.0_31]
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258) ~[na:1.6.0_31]
at java.io.BufferedInputStream.read(BufferedInputStream.java:317) ~[na:1.6.0_31]
at org.bson.io.Bits.readFully(Bits.java:35) ~[mongo-java-driver-2.7.3.jar:na]
I am using the Mongo driver directly, and have made sure to create only a singleton Mongo instance, and I have verified it is being created. As far as I can tell it is occuring only when I am requesting data
When authenticating a user, it occurs on the second of these two lines:
DBCollection users = DBManager.getDB("mojulo").getCollection("users"); /*Get the Mongo singleton then get the "users" collection */
DBObject user = users.findOne(new BasicDBObject("username", username)); /*find the user with the specified username */
When trying to register a user, it occurs after I attempt the insert, and the insert is not successful. on the second of these two lines:
WriteResult result = users.insert(new_user); /* attempt to insert a new user */
if(result.getLastError().ok()){ /* make sure it worked, error occurs on this line */
...
I am fairly clueless here, I feel that there might be a threading issue? because it randomly worked once, but then stopped working. Any light someone could shed on this would be greatly appreciated
EDIT:
Wish I could more explicitly state the problems I am having here, but they are very sporadic. It seems to work maybe 10% of the time, and then stop working.