Pass 2 at correcting xcatd infinite patience with clients
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12393 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
75d37c0a6f
commit
d7088aa571
@ -34,7 +34,7 @@ use xCAT::MsgUtils;
|
||||
use File::Path;
|
||||
use Time::HiRes qw(sleep);
|
||||
use Thread qw(yield);
|
||||
use Fcntl ":flock";
|
||||
use Fcntl qw/:DEFAULT :flock/;
|
||||
use xCAT::Client qw(submit_request);
|
||||
my $clientselect = new IO::Select;
|
||||
my $sslclients = 0; #THROTTLE
|
||||
@ -92,7 +92,7 @@ Getopt::Long::Configure("bundling");
|
||||
Getopt::Long::Configure("pass_through");
|
||||
|
||||
use Storable qw(dclone);
|
||||
use POSIX qw(WNOHANG setsid);
|
||||
use POSIX qw(WNOHANG setsid :errno_h);
|
||||
my $pidfile;
|
||||
my $foreground;
|
||||
GetOptions(
|
||||
@ -1687,12 +1687,25 @@ sub service_connection {
|
||||
eval { #REMOVEEVALFORDEBUG
|
||||
my $request;
|
||||
my $req=undef;
|
||||
alarm(15);
|
||||
while (<$sock>) {
|
||||
alarm(0);
|
||||
$request .= $_;
|
||||
my $line;
|
||||
my $flags;
|
||||
fcntl($sock,F_GETFL,$flags);
|
||||
$flags |= O_NONBLOCK; #we want sysread to bail on us, select seems to be evil to us still..
|
||||
fcntl($sock,F_SETFL,$flags);
|
||||
my $clientsel = new IO::Select;
|
||||
$clientsel->add($sock);
|
||||
while (1) {
|
||||
$line="";
|
||||
unless ($clientsel->can_read(15)) { last; } #don't let an unresponsive client hold us up
|
||||
my $bytesread;
|
||||
do { $bytesread=sysread($sock,$line,65536,length($line)) } while ($bytesread);
|
||||
if (length($line)==0) {
|
||||
if (not defined $bytesread and $! == EAGAIN) { next; } #
|
||||
last;
|
||||
}
|
||||
$request .= $line;
|
||||
#$req = eval { XMLin($request, ForceArray => [ 'attribute' , 'attributepair' ]) };
|
||||
if (m/<\/xcatrequest>/) {
|
||||
if ($line =~ m/<\/xcatrequest>/) {
|
||||
$req = eval { XMLin($request, SuppressEmpty=>undef,ForceArray=>1) };
|
||||
#first change peername on 'becomeuser' tag if present and valid
|
||||
if (defined $req->{becomeuser}) {
|
||||
@ -1780,7 +1793,6 @@ sub service_connection {
|
||||
next;
|
||||
}
|
||||
}
|
||||
alarm(15);
|
||||
}
|
||||
}; #REMOVEEVALFORDEBUG
|
||||
if ($@) { # The eval statement caught a program bug..
|
||||
|
Loading…
Reference in New Issue
Block a user