After upgrade from Rails 5.2 to 6.0
I got this error randomly but not often when exploratory testing in a deployed instances in AWS.
When it happened it persisted for a while
ActiveRecord::ConnectionNotEstablished No connection pool with 'primary' found.
But it never found in local with the same configure. (Both connect to the same DB)
Any suggestion or solution would be helpful. Thank you.
The drastically dropped connection count found when this error occurred
Error and RDS connection count
Log from server when error occured
2021-03-25 10:58:14 +0700 Using rack adapter
TRG Started 2021-03-25 10:58:19 +0700
2021-03-25 10:58:20 +0700 Thin web server (v1.8.0 codename Possessed Pickle)
2021-03-25 10:58:20 +0700 Maximum connections set to 1024
2021-03-25 10:58:20 +0700 Listening on 0.0.0.0:8080, CTRL+C to stop
...
2021-03-25 11:13:36 +0700 Unexpected error while processing request: No connection pool with 'primary' found.
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:1146:in `retrieve_connection'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/connection_handling.rb:189:in `connection'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/relation/calculations.rb:193:in `block in pluck'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/relation.rb:839:in `skip_query_cache_if_necessary'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/relation/calculations.rb:193:in `pluck'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/schema_migration.rb:52:in `all_versions'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1084:in `get_all_versions'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1091:in `current_version'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.5/lib/active_record/migration.rb:1191:in `current_version'
/data/acm-trg/lib/rack/health_check.rb:35:in `rail_migration_version'
/data/acm-trg/lib/rack/health_check.rb:15:in `call'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thin-1.8.0/lib/thin/connection.rb:86:in `block in pre_process'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thin-1.8.0/lib/thin/connection.rb:84:in `catch'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thin-1.8.0/lib/thin/connection.rb:84:in `pre_process'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/thin-1.8.0/lib/thin/connection.rb:50:in `block in process'
/home/centos/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:1077:in `block in spawn_threadpool'
Updated
- Upgrade from aurora mysql 5.6 to 5.7 do not fix this issue
