0

I use mongoid 4.0 with servers hosted in a cloud service (A Ubuntu VM @ Windows Azure).

avril14th@avril14th-ubuntu:~/src/white$ rails c
Loading production environment (Rails 4.1.4)
2.1.2 :001 > User.count
 => 0 

Now, if I leave the console or server idle for say 5 minutes and go again:

2.1.2 :002 > User.count

this can remain idle for hours, never returning. Only way for me to get connection back is to close the server/console and start again.

What is the trick to keep a connection alive whatever happens?

muichkine
  • 2,890
  • 2
  • 26
  • 36
  • I have also experienced this in dev environment on my console, but this doesn't happen in production. Are you experiencing the same in production environment? This may have something to do with your cloud mongo installation not responding/closing connection, but I am not sure. – amit_saxena Aug 31 '14 at 20:37
  • Yes I do have the same problem as soon as the ongo instance is not on the same server as the ruby application – muichkine Sep 01 '14 at 06:46
  • Did you try contacting your cloud provider? I use mongohq and haven't seen such problem in production environment, though I do get it in dev environment for their sandbox databases. – amit_saxena Sep 01 '14 at 07:19
  • @muichkine did you ever find a solution to this? I had a similar (same?) issue and posted here: https://stackoverflow.com/questions/24210058/mongoid-4-mongodb-2-4-freezing-issue. I even blogged about it :P (see http://www.alexbevi.com/blog/2014/06/23/troubleshooting-a-mongoid-connection-issue/). Just moved back to Azure and having the same issue again. – Alex B. Mar 19 '15 at 14:50
  • @AlexB. No, what I did was stop using my own instances and move to a hosted mongodb service (mongolab as it is listed in Azure's external services list). Since then no problem were encountered. – muichkine Mar 24 '15 at 12:03

0 Answers0