Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Writes fail with ConnectionPool::PoolShuttingDownError #345

Closed
dblock opened this issue Feb 2, 2015 · 46 comments
Closed

Writes fail with ConnectionPool::PoolShuttingDownError #345

dblock opened this issue Feb 2, 2015 · 46 comments

Comments

@dblock
Copy link
Contributor

dblock commented Feb 2, 2015

Something happens in our MongoDB configuration (likely a step down of a master or some kind of failure) that causes all servers to start reporting the following error: ConnectionPool::PoolShuttingDownError on database writes to primary.

This is recent, we've seen it take out all our writes twice.

Moped 2.0.3
Mongoid 4.0.0

…nnection_pool-2.1.1/lib/connection_pool/timed_stack.rb:  78:in `block (2 levels) in pop'
…nnection_pool-2.1.1/lib/connection_pool/timed_stack.rb:  77:in `loop'
…nnection_pool-2.1.1/lib/connection_pool/timed_stack.rb:  77:in `block in pop'
…nnection_pool-2.1.1/lib/connection_pool/timed_stack.rb:  76:in `synchronize'
…nnection_pool-2.1.1/lib/connection_pool/timed_stack.rb:  76:in `pop'
….0.0/gems/connection_pool-2.1.1/lib/connection_pool.rb:  78:in `checkout'
….0.0/gems/connection_pool-2.1.1/lib/connection_pool.rb:  60:in `with'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 114:in `connection'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 140:in `disconnect'
….0.0/gems/moped-2.0.3/lib/moped/failover/disconnect.rb:  26:in `execute'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 185:in `rescue in ensure_connected'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 188:in `ensure_connected'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 589:in `block in flush'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 617:in `block in logging'
…ctivesupport-4.1.8/lib/active_support/notifications.rb: 159:in `block in instrument'
…4.1.8/lib/active_support/notifications/instrumenter.rb:  20:in `instrument'
…ctivesupport-4.1.8/lib/active_support/notifications.rb: 159:in `instrument'
…uby/2.0.0/gems/moped-2.0.3/lib/moped/instrumentable.rb:  31:in `instrument'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 616:in `logging'
…lic_moped-0.0.12/lib/newrelic_moped/instrumentation.rb:  40:in `block in logging_with_newrelic_trace'
…lic_moped-0.0.12/lib/newrelic_moped/instrumentation.rb:  49:in `call'
…lic_moped-0.0.12/lib/newrelic_moped/instrumentation.rb:  49:in `block in logging_with_newrelic_trace'
…lic_moped-0.0.12/lib/newrelic_moped/instrumentation.rb:  46:in `logging_with_newrelic_trace'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 587:in `flush'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 358:in `pipeline'
…by/2.0.0/gems/moped-2.0.3/lib/moped/operation/write.rb:  47:in `execute'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 665:in `write'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 502:in `update'
…gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/query.rb: 427:in `block in update'
…avity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/cluster.rb: 249:in `block in with_primary'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 204:in `block in ensure_primary'
…ty/ruby/2.0.0/gems/moped-2.0.3/lib/moped/executable.rb:  25:in `execute'
…/gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/node.rb: 203:in `ensure_primary'
…avity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/cluster.rb: 248:in `with_primary'
…gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/query.rb: 426:in `update'
…by/2.0.0/gems/mongoid-4.0.0/lib/mongoid/query_cache.rb: 117:in `update_with_clear_cache'
…gravity/ruby/2.0.0/gems/moped-2.0.3/lib/moped/query.rb: 449:in `update_all'
…by/2.0.0/gems/mongoid-4.0.0/lib/mongoid/query_cache.rb: 117:in `update_all_with_clear_cache'
….0/gems/mongoid-4.0.0/lib/mongoid/contextual/atomic.rb: 152:in `set'
…uby/2.0.0/gems/mongoid-4.0.0/lib/mongoid/contextual.rb:  16:in `set'
@Zhomart
Copy link

Zhomart commented Feb 6, 2015

I started getting this error too. Restarting solved. Now I want to know why is this happening.

I have these settings:

production:
  sessions:
    default:
      uri: <%= ENV['MONGO_URI'] %>
      options:
        timeout: 20
        pool_timeout: 5
        pool_size: 32

I'm using puma with 1 worker and 16:64 threads.

@argami
Copy link

argami commented Feb 7, 2015

Same error here.

Similar configuration but using Mongoid 4.0.1 and Moped 2.0.3

Puma with 3 workers and 8:16 Threads

BTW and not sure if is related, i have the pool_timeout set on 5 and still getting "Waited 0.5 sec" Timeout error

@jarthod
Copy link

jarthod commented Feb 9, 2015

Got this issue too since my last update of moped and mongoid.
I haven't changed my setup so this is probably a regression.
I have a sidekiq process with 10 threads and a long running daemon with 10 threads
My mongoid is configured with a pool size of 15.

@fedenusy
Copy link
Contributor

Seeing this as well. Mongoid 4.0.1 / Moped 2.0.3.

Running pool sizes 5-50 on different parts of my app. Default pool timeout.

Seems most frequent in multi-threaded environments (sidekiq + my own celluloid app).

Don't think I've seen this in my "single-threaded" Rails instances.

@fedenusy
Copy link
Contributor

I think I see the issue. Check out moped/node.rb line 153:

@pool = Connection::Manager.shutdown(self)

@pool will hold its value until shutdown returns. But shutdown may take some time. During this time, other calls to the node will continue to use the pool that's shutting down.

I'll monkey-patch and report back.

@dblock
Copy link
Contributor Author

dblock commented Feb 11, 2015

@fedenusy 🎸

@fedenusy fedenusy mentioned this issue Feb 12, 2015
dblock added a commit to dblock/moped that referenced this issue Feb 12, 2015
arthurnn added a commit that referenced this issue Feb 12, 2015
@niedfelj
Copy link

I have a PR that has been sitting there for all of these issues. PR #338 IMHO Durran's connection fix isn't adequate. There are still some issues to resolve with the way moped handles stepdowns/failovers etc, but I think first we have to get the connection pool behaving properly.

@fedenusy
Copy link
Contributor

@arthurnn I think this issue should remain open. I've had my "fix" live on prod for over a week now, and while the ConnectionPool::PoolShuttingDownError occurs less frequently, it's definitely still there.

#338 seems promising. Definitely worth another look.

@Zhomart
Copy link

Zhomart commented Feb 20, 2015

I've got this issue again using master branch.

@dblock
Copy link
Contributor Author

dblock commented Feb 20, 2015

Fyi, been running this well in production at artsy.net for the last 72 hours. Haven't seen this error again.

@Genkilabs
Copy link

I bumped to latest master 2.0.4 (mongoid 4.0.1) and am seeing this error like crazy still.
Testing DB is on a dedicated replica set on http://compose.io

@ardeearam
Copy link

This issue is happening to us as well.

Mongoid (4.0.2)
Moped (2.0.4)

Is there a particular old version that is not experiencing this error? I am thinking of just using an old version, since it seems to be (as per thread) regression.

@fedenusy
Copy link
Contributor

fedenusy commented Mar 3, 2015

@ardeearam try this in your Gemfile:

gem 'moped', '2.0.4', github: 'wandenberg/moped', branch: 'operation_timeout'

Fixed this error almost entirely on my 150+ concurrency sidekiq instances. #348 still pops up though.

@ardeearam
Copy link

Thanks @fedenusy! Will try it and will let you know.

@ardeearam
Copy link

@fedenusy restarted the servers with the operation_timeout branch deployed... Seems ok now. Will observe for days then I'll get back to you all.

@yorickpeterse
Copy link

Seeing this particular error pop up like crazy using moped 2.0.4, currently deploying the patches mentioned by @fedenusy to see how that goes. If it helps, the backtraces look like the following:

ConnectionPool::PoolShuttingDownError: ConnectionPool::PoolShuttingDownError
1 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.1.3/lib/connection_pool/timed_stack.rb" line 78 in block (2 levels) in pop
2 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.1.3/lib/connection_pool/timed_stack.rb" line 77 in loop
3 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.1.3/lib/connection_pool/timed_stack.rb" line 77 in block in pop
4 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.1.3/lib/connection_pool/timed_stack.rb" line 76 in synchronize
5 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.1.3/lib/connection_pool/timed_stack.rb" line 76 in pop
6 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.1.3/lib/connection_pool.rb" line 78 in checkout
7 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/connection_pool-2.1.3/lib/connection_pool.rb" line 60 in with
8 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 114 in connection
9 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 178 in ensure_connected
10 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 589 in block in flush
11 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 617 in block in logging
12 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb" line 164 in block in instrument
13 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications/instrumenter.rb" line 20 in instrument
14 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb" line 164 in instrument
15 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/instrumentable.rb" line 31 in instrument
16 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 616 in logging
17 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/newrelic_moped-0.0.12/lib/newrelic_moped/instrumentation.rb" line 40 in block in logging_with_newrelic_trace
18 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/newrelic_moped-0.0.12/lib/newrelic_moped/instrumentation.rb" line 59 in call
19 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/newrelic_moped-0.0.12/lib/newrelic_moped/instrumentation.rb" line 59 in logging_with_newrelic_trace
20 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 587 in flush
21 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 391 in process
22 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/operation/read.rb" line 48 in execute
23 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 648 in read
24 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 90 in command
25 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/node.rb" line 432 in refresh
26 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/cluster.rb" line 188 in block in refresh
27 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/cluster.rb" line 200 in each
28 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/cluster.rb" line 200 in refresh
29 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/cluster.rb" line 151 in nodes
30 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/cluster.rb" line 246 in with_primary
31 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/read_preference/primary.rb" line 55 in block in with_node
32 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/read_preference/selectable.rb" line 65 in call
33 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/read_preference/selectable.rb" line 65 in with_retry
34 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/read_preference/primary.rb" line 54 in with_node
35 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/cursor.rb" line 136 in load_docs
36 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/query_cache.rb" line 234 in block in load_docs
37 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/query_cache.rb" line 135 in with_cache
38 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/query_cache.rb" line 234 in load_docs
39 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/cursor.rb" line 27 in each
40 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/moped-2.0.4/lib/moped/query.rb" line 77 in each
41 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/contextual/mongo.rb" line 122 in each
42 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/contextual.rb" line 20 in each
43 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/criteria/findable.rb" line 107 in entries
44 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/criteria/findable.rb" line 107 in from_database
45 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/criteria/findable.rb" line 75 in multiple_from_db
46 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/criteria/findable.rb" line 19 in execute_or_raise
47 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/criteria/findable.rb" line 40 in find
48 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/vendor/bundle/ruby/2.2.0/gems/mongoid-4.0.2/lib/mongoid/findable.rb" line 90 in find
49 File "/var/www/feedback_daemon/deploy-2015-03-20_10_48_55/lib/feedback_daemon/worker.rb" line 142 in survey
...

@yorickpeterse
Copy link

The patches mentioned by @fedenusy seem to do the trick, I'm not seeing the pool errors anymore.

jonhyman pushed a commit to jonhyman/moped that referenced this issue Apr 3, 2015
jonhyman pushed a commit to jonhyman/moped that referenced this issue Apr 3, 2015
@xinuc
Copy link

xinuc commented Apr 6, 2015

still seeing this error on 2.0.4 😞

@jeremyhaile
Copy link

I'm also still seeing this issue on 2.0.4

@xuanyu-h
Copy link

some issue on 2.0.4

@topac
Copy link

topac commented Apr 29, 2015

I'm also seeing this on Windows with version 2.0.4.

Seems to happen (this is just an hypothesis) when my process spawns a number of threads (each one conntect to mongo via mongoid) greater than then mogoid pool size.

@jonhyman
Copy link
Contributor

jonhyman commented May 4, 2015

@fedenusy / @wandenberg, what are the commits which fix this? I have my own fork because of other patches that we need. I'd like to cherry-pick them into my fork. We just upgraded production last night and this error took part of us down until all the processes were restarted.

@oreofish
Copy link

oreofish commented May 9, 2015

+1

@matsimitsu
Copy link

We "fixed" it by reverting to 2.0.1 for now.

@knovoselic
Copy link

Still happening on v2.0.4.

@paulmakepeace
Copy link

+1
Using mongoid 4.0.2
Using moped 2.0.4

gem 'moped', '2.0.1'  # https://github.com/mongoid/moped/issues/345

working so far, too.

@jonhyman
Copy link
Contributor

Give this branch a try. We upgraded from 1.5 to 2.0 about 3 weeks ago and have seen absolutely horrible failover handling with Moped 2.0. We finally now can do stepdowns in production without a single error and haven't seen this error anymore. I cherry-picked in various commits from other pulls that address this and also added many commits of my own to handle different failure scenarios.

https://github.com/jonhyman/moped/tree/feature/15988-and-logging

It has some extra logging in there that I've been using as we've been doing failover testing, so feel free to fork and remove if you inspect your Moped logs. We've also tested kill -9'ing the primary mongod on this branch and killing a mongos successfully, whereas on 2.0.4 it couldn't handle any of those scenarios.

@fabiob
Copy link

fabiob commented Jun 12, 2015

@jonhyman, your branch is fantastic! When can we expect a PR?

@jonhyman
Copy link
Contributor

Thanks. Yeah, we've used my branch through multiple stepdowns and incidents (like a mongos running out of memory, a physical host failing, etc.) and it holds up great now. I don't think there's any support for Moped anymore. @durran are you interested in me cleaning up my branch (basically just removing the log statements I added) and letting me submit a pull?

@durran
Copy link
Member

durran commented Jun 14, 2015

@jonhyman Yeah please do... I'll merge in and release a new version then.

@jonhyman
Copy link
Contributor

@durran #379

@jarthod
Copy link

jarthod commented Jul 20, 2015

See #380 for the up-to date MR fixing this.

@Veejay
Copy link

Veejay commented Aug 28, 2015

Doing a bundle update moped on my project (which was using mongoid 4.0.2 and moped 2.0.3 initially) to solve the aforementioned errors (ConnectionPool::PoolShuttingDownError) also bumped the version for the bson gem from 2.3.0 to 3.2.1

Should I expect any side-effects from this update on the bson gem?

EDIT: And thanks to all involved in fixing this, great work.

@jonhyman
Copy link
Contributor

I have not tested 3.2.1. We are using bson 2.3.0.

@Veejay
Copy link

Veejay commented Aug 28, 2015

@jonhyman: Doesn't moped 2.0.7 require bson ~> 3.0?

@jonhyman
Copy link
Contributor

We're still on my branch I made on May 20. I never bothered to upgrade to 2.0.7 because my branch is working fine for us, and the next mongoid upgrade we are doing is to mongoid 5 / official driver.

@Veejay
Copy link

Veejay commented Aug 28, 2015

@jonhyman : Ah OK. Thanks.

Has anyone else tested moped 2.0.7 with bson 3.2.1?

@fedenusy
Copy link
Contributor

I've been running moped 2.0.7 + bson 3.2.1 for about a week now. Seems good
so far.
On Fri, Aug 28, 2015 at 6:30 AM Bertrand Chardon notifications@github.com
wrote:

@jonhyman https://github.com/jonhyman : Ah OK. Thanks.

Has anyone else tested moped 2.0.7 with bson 3.2.1?


Reply to this email directly or view it on GitHub
#345 (comment).

@Veejay
Copy link

Veejay commented Aug 28, 2015

@fedenusy: Thank you very much. Nice to know 👍

@alexandru-calinoiu
Copy link

We are usin moped at 2.0.7 and bson at 3.2.1 and still getting about 6k ConnectionPool::PoolShuttingDownError errors, is there something else that can cause this issue.

@jarthod
Copy link

jarthod commented Sep 2, 2015

I also got a few them with 2.0.7, much less than before though.

@nodkz
Copy link

nodkz commented Oct 7, 2015

I have broken ReplicaSet were slave is DOWN and primary is OK. So got tons of ConnectionPool::PoolShuttingDownError.

I downgraded from moped 2.0.7 to
gem 'mongoid', '4.0.0' gem 'moped', '2.0.1'
And now no any errors ConnectionPool::PoolShuttingDownError.

@Genkilabs
Copy link

I upgraded everything and am now running:

  • ruby 2.2.3 rails 4.2.x mongoid 4.0.2 moped 2.0.7 bson 3.2.4
    This stack has been working well for me with unicorn running web and various workers under somewhat heavy load (about 2400 connections and ~2-3k ops/sec) for a few days now without the error.

This is, I think, the last good version of mongoid before 5.0.0 and the switch away from moped entirely. If it is minimal impact to bump up everything to that spec, it might be worth a try...

@yangtheman
Copy link

I can confirm that downgrading from 2.0.7 to 2.0.1 fixed the problem.

@Veejay
Copy link

Veejay commented May 24, 2016

To the people who downgraded their version of moped from 2.0.7 to 2.0.1, what motivated the switch to that particular version? I've been seeing those errors as well with the 4.0.2/2.0.7/3.2.1 Mongoid/Moped/BSON setup so I'm interested by the motivations for the move to 2.0.1

@Genkilabs
Copy link

I forget the exact errors, it's been a while, but it was something like dropping connections or excessive shutdowns. I think I recall something with "Pool" in it... Connection level stuff.
Anyways, I have been on 4.0.2/2.0.7/3.2.4 for months now with a continuous baseline of a few thousands of ops/sec.
I did have logging set up to match my env, something like

    Mongoid.logger.level = ENV['LOG_LEVEL'] || 0
    Mongo::Logger.logger.level = ENV['LOG_LEVEL'] || 0

But this spammed me with TONS of warnings about connection considerations; even when log level was up at :error. I commented it out and it has been running fine.
I notice your BSON is a little different than mine, maybe bump it and re-test?
I know thats not much to go on... hopefully it sparks something.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.