Comments (5)
This is not a elegant solution but I think it will work:
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
ActiveRecord::Base.connection_proxy.instance_variable_get(:@shards).each do |shard, connection_pool|
connection_pool.disconnect!
end
end
end
end
But I'm using puma these days which not require this kind of configuration.
Closing :)
from octopus.
This erro also happens on unicorn, and putting this line on the after_fork seems to fix it:
ActiveRecord::Base.connection_proxy.instance_variable_get(:@shards).each {|k,v| v.clear_reloadable_connections! }
Try putting this on the Passenger config. (I'm not sure how you should do this, but here is my guess):
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
ActiveRecord::Base.connection_proxy.instance_variable_get(:@shards).each {|k,v| v.clear_reloadable_connections! }
end
end
end
from octopus.
FWIW, the fix that @tchandy mentioned above seems to be working for me. A similar fix is also in the StackOverflow post that the OP mentioned...look for the post from Jan 30 at the bottom.
If anyone else can confirm this, then this might be closed!
Edit: the fix that is working for me is the one for Passenger, I haven't tried Unicorn at all.
from octopus.
We also have been suffering from intermittent 'Lost connection' and 'ActiveModel::MissingAttributeError' errors.
After applying @sobrinho 's solution, those errors have gone completely.
Thanks so much!
from octopus.
😆
from octopus.
Related Issues (20)
- Octopus 0.10.2 / Rails 5.1.5 / Sidekiq workers eventually run out of memory and freeze
- Not able to access the wiki page HOT 4
- Config file setting of wiki is outdated? HOT 1
- could not obtain a database connection within 5.000 seconds HOT 2
- Rails 6 migration / compatibility HOT 3
- How does the ActiveRecord connection pool interact with Octopus? HOT 4
- Rails 6 release HOT 6
- Octopus error at startup with Rails 6: `alias_method': undefined method `any?' for class `ActiveRecord::Associations::CollectionAssociation' (NameError) HOT 7
- Update methods sent to read-only database with identity_cache gem
- Sidekiq job random failures due to proxy_config is nil
- octopus for ruby project HOT 1
- Delayed Job + Octopus 0.10.2 issues on Rails 5.2 (undefined method `any?' for nil:NilClass) HOT 2
- ActiveRecord 5.2 StatementCache Pins Queries to Shards
- Octopus is already running
- octopus 0.6.1 make rake unit test failling.. HOT 1
- Would sponsorship help? HOT 2
- I can't able to use gem 'ar-octopus' in rails 6.0.3 HOT 2
- Octopus doesn't work with Rails' schema cache HOT 1
- New Maintainer HOT 4
- Preventing Duplicate Migrations on the Same Shard for Rails > 5.2 and ar-octopus (0.10.2) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from octopus.