Re: beacon 0.9.58 dies after a while - broken pipe?
On Thu, 29 Jul 2004 10:04:42 -0500
John Kristoff <jtk@northwestern.edu> wrote:
> I also have seen this, but haven't been able to pinpoint it. I was
[...]
I believe I've narrowed things down quite a bit. I ran the script
with truss on my system and noticed that eventually I kept getting an
EPIPE error when writing the report to the TCP pipe back to the central
beacon.ncsa.uiuc.edu server. This causes one of the 'print' statements
to fail and the script to eventually stop without warning or notice. I
have not been able to determine why the TCP connection goes away in
the middle of writing to the pipe, but I suspect it may be a problem
on the server's end, since there are multiple people experiencing this
behavior.
Mitch, if the problem is on the server end we would need you or a
beacon server admin to debug why TCP connections are being abruptly
lost. Is there anything you can see wrong?
In the meantime, in order to keep my client working I am basically
ignoring the problem. Probably not the best thing to do, but I
suppose for those experiencing this as well, it may be an acceptable
option short of some kind of external watcher script or daemon tool.
Here is a diff to the 0.9.58 RC1 -2 src/beacon.in script:
--- beacon.in
+++ beacon.in.new
@@ -2370,7 +2370,12 @@
}
$connection_to_tcp_server = 1;
}
-
+
+### JTK: hack to avoid unexpected TCP close during writes
+use POSIX qw(:errno_h);
+$SIG{PIPE} = 'IGNORE';
+### JTK
+
# FIRST LINE - Authentication string: The Central Server will ignore any
# TCP traffic to this port that doesn't start with the appropriate line:
# "beacon.dast.nlanr.net:233.4.200.22:10006" (Or your CS Name, group, port)
@@ -2555,7 +2560,10 @@
}
# and terminate the connection when we're done
- close($socket) || die ("Couldn't close TCP reporting socket" );
+### JTK: hack to avoid lost socket during unexpected TCP close
+# close($socket) || die ("Couldn't close TCP reporting socket" );
+ close($socket) || print STDERR "Warning, couldn't close socket $socket: $!\n";
+### JTK
return;
John