Skip to content

Commit

Permalink
Fix a crash when an Executor wrapped fork exit.
Browse files Browse the repository at this point in the history
Fix rails#51298

forking inside an Execution Wrapper crashes when running the completion callbacks.

Rails 7.0 was not Execution wrapping the `runner` command.
Rails 7.2 changed the definition of `active_connection?`, the new definition doesn't contain the bug.

Therefore forking inside a script intended to be run with the `runner` command on 7.1 crashes. (see rails#51298)
  • Loading branch information
JoeDupuis committed May 9, 2024
1 parent 0e14713 commit b3d0bd1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/query_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def self.run
end

def self.complete(pools)
pools.each { |pool| pool.disable_query_cache! }
pools.each { |pool| pool.disable_query_cache! unless pool.discarded? }

ActiveRecord::Base.connection_handler.each_connection_pool do |pool|
pool.release_connection if pool.active_connection? && !pool.connection.transaction_open?
Expand Down

0 comments on commit b3d0bd1

Please sign in to comment.