From 12bfd5699dc69fdaf79ab1af59d2d69336ae9248 Mon Sep 17 00:00:00 2001 From: xuweibj Date: Fri, 1 Jun 2018 14:30:53 +0800 Subject: [PATCH] if not get valid pid when waitpid, sleep (#5274) --- xCAT-server/lib/xcat/plugins/openbmc.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 7841afcde..1a20bf10f 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1088,8 +1088,10 @@ rmdir \"/tmp/\$userid\" \n"; } if (%child_node_map) { + my $pid_flag = 0; while ((my $cpid = waitpid(-1, WNOHANG)) > 0) { if ($child_node_map{$cpid}) { + $pid_flag = 1; my $node = $child_node_map{$cpid}; my $rc = $? >> 8; if ($rc != 0) { @@ -1107,6 +1109,9 @@ rmdir \"/tmp/\$userid\" \n"; delete $child_node_map{$cpid}; } } + unless ($pid_flag) { + select(undef, undef, undef, 0.01); + } } my @del; while (my ($k, $v) = each %node_wait) {