From 8de3e9c87215f5d70bdd80f938b03a038ef6a569 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 --- 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 f9835b2937..b268e4bc33 100644 --- a/src/im_mad/remotes/lib/vcenter_cluster.rb +++ b/src/im_mad/remotes/lib/vcenter_cluster.rb @@ -738,6 +738,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 = ''