All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 44ad0041 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Be more forgiving of failed syswrite/sysread to the TIP socket during

the connection handshake. If the capture is active, it is going to
write status and close the socket on its end, which may or may not be
propogated back to the client side before/after/during the
sysread/syswrite. I guess that a miserable way of saying there is a
lot of asynchrony involved.
parent 4b8a2889
...@@ -178,17 +178,24 @@ sub tipconnect($) { ...@@ -178,17 +178,24 @@ sub tipconnect($) {
} }
TIP->autoflush(1); TIP->autoflush(1);
# While its a fatal error if the connect fails, the write and the
# read that follows might fail because the tip is currently is
# active. The handshake writes back a value and then immediately
# closes the socket, which could manifest itself as a closed
# connection on this end, even before we get a change to do these.
# operations. In that case, just go around the loop again. We hope
# to succeed at some point.
if (! syswrite(TIP, $secretkey)) { if (! syswrite(TIP, $secretkey)) {
print STDERR print STDERR
"*** Cannot write to $controller on $server($portnum)\n"; "*** Cannot write to $controller on $server($portnum)\n";
close(TIP); goto again;
return 0;
} }
if (! sysread(TIP, $capret, length($capret))) { if (! sysread(TIP, $capret, length($capret))) {
print STDERR print STDERR
"*** Cannot read from $controller on $server($portnum)\n"; "*** Cannot read from $controller on $server($portnum)\n";
close(TIP); goto again;
return 0;
} }
my $foo = unpack("i", $capret); my $foo = unpack("i", $capret);
...@@ -198,12 +205,15 @@ sub tipconnect($) { ...@@ -198,12 +205,15 @@ sub tipconnect($) {
if ($foo == 0) { if ($foo == 0) {
return(*TIP); return(*TIP);
} }
if ($i > 5) {
if ($i && (($i % 5) == 0)) {
printf STDERR printf STDERR
"*** WARNING: $controller on $server($portnum) is busy\n". "*** WARNING: $controller on $server($portnum) is busy\n".
" Waiting a bit before trying again.\n"; " Waiting a bit before trying again. Pass $i.\n";
} }
sleep(5); sleep(5);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment