I have a Rails 4.0 app that's using MongoDb. I'm using Mongoid as the ORM. Up until this afternoon, everything was working just fine.
Suddenly, I'm getting random timout errors.
First a message from MOPED:
MOPED: Retrying connection attempt 1 more time(s). runtime: n/a
and then a
Timeout::Error is thrown: Exception: Waited for item but none was pushed.
Looking at the source, it looks like it's a problem somewhere in the connection pooling code, but I'm not familiar enough with it to say.
Anyone have any experience with this issue?
Are you running rails on the top of what? JRuby? Puma? Sidekiq? There seems to be a problem where you dont have connections enough in the pool.., Or maybe the code is not freeing the connections after the finish(still is not likely to happen. The default connection pool size is 5, so if you have more than 5 concurrent request, in a multi-thread server(like puma), you would start getting those errors. What I think you should do is increase the number of connections in the pool( you can pass a option in mongoid.yml pool_size ) to 20 or something. And see if the errors are still happening.
If you still thing the code is no freeing the connections back to the pool you can open an issue on github https://github.com/mongoid/moped/issues/new