From 921b7d5ea3553ca6de61fe67caa6f11ee033366e Mon Sep 17 00:00:00 2001 From: WangXiaoPeng Date: Fri, 24 Jul 2015 01:17:36 -0400 Subject: [PATCH] defect 4759: Fix the issue that ssl_listener used up all cpu. --- xCAT-server/sbin/xcatd | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index ac5e4e2eb..d6ad7304b 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -1156,7 +1156,17 @@ until ($quit) { push @pendingconnections,$tconn; } } else { - $bothwatcher->can_read(30); + # if select returned with no ready fds, there might be udpctl broken. + if (not $bothwatcher->can_read(30)) { + # if the errno is 'bad fd', check the health of the udpctl + if ($! == EBADF) { + $udpwatcher->can_read(0); + if ($! == EBADF) { + # if udpctl cannot be read and said 'bad fd', remove it from $bothwatcher + $udpalive = 0;$bothwatcher = IO::Select->new($listener); + } + } + } if (not $listenwatcher->can_read(0)) { # check for udpctl messages since # we have no listen to hear next;