From c42b355c39547a44b4ae8677c88ee9959ebf572d Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 5 Jun 2020 00:46:02 +0900 Subject: [PATCH] Revert "Ivar += in MRI is thread safe" This reverts commit dd1aa7388990509796065d4cd19534d4017b42bc. Since this ivar is updated in a synchronize block just below, and has to be protected from other threads Co-authored-by: Ryuta Kamizono --- .../connection_adapters/abstract/connection_pool.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index c8fa83afc7..f86b7dadfc 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -822,12 +822,8 @@ module ActiveRecord end def with_new_connections_blocked - if RUBY_ENGINE == "ruby" + synchronize do @threads_blocking_new_connections += 1 - else - synchronize do - @threads_blocking_new_connections += 1 - end end yield