From c09e698709049cfbaa8d0cff22a3afafc309487a Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Wed, 10 Jul 2019 13:58:51 +0200 Subject: [PATCH] Applied workaround for issue #2656: Disable new Rails database connection reaping functionality until the Thread-Zombie issue is resolved: https://github.com/rails/rails/issues/33600 . --- config/application.rb | 1 + ...e_2656_workaround_for_rails_issue_33600.rb | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 config/issue_2656_workaround_for_rails_issue_33600.rb diff --git a/config/application.rb b/config/application.rb index f6e0f1187..b66414fd5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,7 @@ require_relative 'boot' require 'rails/all' +require_relative 'issue_2656_workaround_for_rails_issue_33600' # DO NOT REMOVE THIS LINE - see issue #2037 Bundler.setup diff --git a/config/issue_2656_workaround_for_rails_issue_33600.rb b/config/issue_2656_workaround_for_rails_issue_33600.rb new file mode 100644 index 000000000..8d1a0a6f2 --- /dev/null +++ b/config/issue_2656_workaround_for_rails_issue_33600.rb @@ -0,0 +1,22 @@ +# This temporary workaround for issue #2656. +# The root cause is an issue in Rails: https://github.com/rails/rails/issues/33600 +# It disables database connnection reaping by setting `reaping_frequency` to 0 for each environment in the config/database.yml file. +# It restores the DB connection reaping behavior Rails > 5.2 had. +# It was proposed in a comment on the Rails issue: https://github.com/rails/rails/issues/33600#issuecomment-415395901 +# It was confirmed by @matthewd (a Rails core maintainer) in another comment: https://github.com/rails/rails/issues/33600#issuecomment-415400522 +module Rails + class Application + class Configuration < ::Rails::Engine::Configuration + + alias database_configuration_original database_configuration + + def database_configuration + database_configuration_original&.transform_values do |config| + config.merge( + 'reaping_frequency' => 0 + ) + end + end + end + end +end