From 1c04ca3c37d34d79d8835291e2578279fe884368 Mon Sep 17 00:00:00 2001 From: Ricardo Diaz Date: Thu, 4 Feb 2021 17:32:23 +0100 Subject: [PATCH] B #-: Monitor CLOSE-WAIT stalled connections (#755) For vCenter monitor, already added hosts were added again, provoking a new call to vcenter_connect. This call makes a new vSphere connection and leaving the previous one hanging. After a timeout, vCenter tried to close the connection by sending a TCP FIN. OS TCP stack cannot tell the application (vcenter_monitor) to close, resulting on a CLOSE-WAIT stalled connections (last forever). This in turn, exhausts the maximum number of file descriptors opened allowed per process. Signed-off-by: Ricardo Diaz (cherry picked from commit 8de3e9c87215f5d70bdd80f938b03a038ef6a569) --- src/im_mad/remotes/lib/vcenter_cluster.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/im_mad/remotes/lib/vcenter_cluster.rb b/src/im_mad/remotes/lib/vcenter_cluster.rb index bc4565f52b..a516d815ba 100644 --- a/src/im_mad/remotes/lib/vcenter_cluster.rb +++ b/src/im_mad/remotes/lib/vcenter_cluster.rb @@ -751,6 +751,8 @@ class ClusterSet # Add a host by id, it access OpenNebula to get connection parameters def add(hid, conf) + return if @mutex.synchronize { @clusters.key?(hid) } + begin cluster = Cluster.new(hid, @client) error = ''