From f1c32f6a11077cfcef9ac968bbea79fb033e2b2b Mon Sep 17 00:00:00 2001 From: Shlee Date: Wed, 28 Jan 2026 20:44:03 +1030 Subject: [PATCH] Unclosed connection leak when replacing pooled connection in SharedTimedStack.try_create (#37335) --- app/lib/connection_pool/shared_timed_stack.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/lib/connection_pool/shared_timed_stack.rb b/app/lib/connection_pool/shared_timed_stack.rb index 14a5285c4..f1ace3301 100644 --- a/app/lib/connection_pool/shared_timed_stack.rb +++ b/app/lib/connection_pool/shared_timed_stack.rb @@ -71,6 +71,7 @@ class ConnectionPool::SharedTimedStack throw_away_connection = @queue.pop @tagged_queue[throw_away_connection.site].delete(throw_away_connection) @create_block.call(preferred_tag) + throw_away_connection.close elsif @created != @max connection = @create_block.call(preferred_tag) @created += 1