You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently upgraded some gems and found that Sidekiq began complaining and crashing web processes because of use-after-fork of Redis file descriptors.
This was fixed by duplicating my sidekiq-configuring initialize code into puma.rb (in the same place where Sequel has disconnect run on its connection pool) but I can't help but feel there is some anti-feature or missing pattern here that Sidekiq or Sequel connects in my pre-fork puma process.
It's not clear to me what the right way to fix this is.
My concrete approach, for example's sake:
initializers/sidekiq.rb
# Suppress configuring Sidekiq when inside a Puma process: instead,# Sidekiq is configured after-fork in `puma.rb`, to avoid Redis# connection file descriptor re-use errors.unlessARGV.any?{ |a| a =~ /puma/}test_hash=ifENV['APP_ENV'] == 'test'{namespace: 'test'}else{}endredis={url: Config.redis_url}.merge(test_hash)Sidekiq.configure_clientdo |config|
config.redis=redisendSidekiq.configure_serverdo |config|
config.redis=redisendend
puma.rb
on_worker_bootdo# force Sequel's thread pool to be refreshedSequel::DATABASES.each(&:disconnect)# Ditto, but for Sidekiq.test_hash=ifENV['APP_ENV'] == 'test'{namespace: 'test'}else{}endSidekiq.configure_clientdo |config|
config.redis={url: Config.redis_url}.merge(test_hash)endend
The text was updated successfully, but these errors were encountered:
I recently upgraded some gems and found that Sidekiq began complaining and crashing
web
processes because of use-after-fork of Redis file descriptors.This was fixed by duplicating my sidekiq-configuring initialize code into
puma.rb
(in the same place where Sequel hasdisconnect
run on its connection pool) but I can't help but feel there is some anti-feature or missing pattern here that Sidekiq or Sequel connects in my pre-fork puma process.It's not clear to me what the right way to fix this is.
My concrete approach, for example's sake:
initializers/sidekiq.rb
puma.rb
The text was updated successfully, but these errors were encountered: