From 8d6834265ff666f552f1c96019e308b5d36cff59 Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Sat, 29 Aug 2026 23:07:32 +0200 Subject: [PATCH] Keep the DRb connection pool alive after socket errors --- lib/drb/drb.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 8073ac0..49c7a01 100644 --- a/lib/drb/drb.rb +++ b/lib/drb/drb.rb @@ -1296,7 +1296,14 @@ def self.make_pool new_pool = [] pool.each do |c| if conn.nil? and c.uri == remote_uri - conn = c if c.alive? + begin + conn = c if c.alive? + rescue StandardError + begin + c.close + rescue StandardError + end + end else new_pool.push c end @@ -1306,7 +1313,12 @@ def self.make_pool when :store then conn = message[1] pool.unshift(conn) - pool.pop.close while pool.size > POOL_SIZE + while pool.size > POOL_SIZE + begin + pool.pop.close + rescue StandardError + end + end conn else nil