[LON-CAPA-cvs] cvs: loncom / loncnew
foxr
lon-capa-cvs@mail.lon-capa.org
Sun, 03 Aug 2003 00:44:32 -0000
foxr Sat Aug 2 20:44:32 2003 EDT
Modified files:
/loncom loncnew
Log:
1. Correct handling of connection failure: Assume it means the host is
unreachable and fail all of the queued transactions. Note that the
inflight transactions should fail on their own time due either to timeout
or send/receive failures.
2. Correct handling of logs for forced death signals. Pull the signal
from the event watcher.
Index: loncom/loncnew
diff -u loncom/loncnew:1.16 loncom/loncnew:1.17
--- loncom/loncnew:1.16 Mon Jul 28 22:33:05 2003
+++ loncom/loncnew Sat Aug 2 20:44:31 2003
@@ -2,13 +2,12 @@
# The LearningOnline Network with CAPA
# lonc maintains the connections to remote computers
#
-# $Id: loncnew,v 1.16 2003/07/29 02:33:05 foxr Exp $
+# $Id: loncnew,v 1.17 2003/08/03 00:44:31 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
-#
-# LON-CAPA is free software; you can redistribute it and/or modify
+## LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@@ -46,6 +45,14 @@
# Change log:
# $Log: loncnew,v $
+# Revision 1.17 2003/08/03 00:44:31 foxr
+# 1. Correct handling of connection failure: Assume it means the host is
+# unreachable and fail all of the queued transactions. Note that the
+# inflight transactions should fail on their own time due either to timeout
+# or send/receive failures.
+# 2. Correct handling of logs for forced death signals. Pull the signal
+# from the event watcher.
+#
# Revision 1.16 2003/07/29 02:33:05 foxr
# Add SIGINT processing to child processes to toggle annoying trace mode
# on/off.. will try to use this to isolate the compute boud process issue.
@@ -602,6 +609,7 @@
sub FailTransaction {
my $transaction = shift;
+ Log("WARNING", "Failing transaction ".$transaction->getRequest());
Debug(1, "Failing transaction: ".$transaction->getRequest());
if (!$transaction->isDeferred()) { # If the transaction is deferred we'll get to it.
my $client = $transaction->getClient();
@@ -664,6 +672,7 @@
sub KillSocket {
my $Socket = shift;
+ Log("WARNING", "Shutting down a socket");
$Socket->Shutdown();
# If the socket came from the active connection set,
@@ -760,14 +769,16 @@
SocketDump(6, $Socket);
my $status = $Socket->Readable();
+
&Debug(2, "Socket->Readable returned: $status");
if($status != 0) {
# bad return from socket read. Currently this means that
# The socket has become disconnected. We fail the transaction.
+ Log("WARNING",
+ "Lond connection lost.");
if(exists($ActiveTransactions{$Socket})) {
- Debug(3,"Lond connection lost failing transaction");
FailTransaction($ActiveTransactions{$Socket});
}
$Watcher->cancel();
@@ -1172,7 +1183,9 @@
$WorkQueue->enqueue($requestData);
if($ConnectionCount < $MaxConnectionCount) {
Debug(4,"Starting additional lond connection");
- MakeLondConnection();
+ if(MakeLondConnection() == 0) {
+ EmptyQueue(); # Fail transactions, can't make connection.
+ }
}
} else { # Can start the request:
Debug(8,"Can start...");
@@ -1363,13 +1376,12 @@
my $watcher= $event->w;
Debug(2,"Signalled to death! via ".$watcher->data);
- my ($signal) = @_;
+ my ($signal) = $watcher->data;
chomp($signal);
Log("CRITICAL", "Abnormal exit. Child $$ for $RemoteHost "
."died through "."\"$signal\"");
LogPerm("F:lonc: $$ on $RemoteHost signalled to death: "
."\"$signal\"");
- die("Signal abnormal end");
exit 0;
}
@@ -1445,6 +1457,7 @@
Log("CRITICAL", "Forking server for ".$host);
$pid = fork;
if($pid) { # Parent
+ $RemoteHost = "Parent";
$ChildHash{$pid} = $RemoteHost;
sigprocmask(SIG_UNBLOCK, $sigset);
@@ -1492,6 +1505,8 @@
print PIDSAVE "$$\n";
close(PIDSAVE);
+
+
if (POSIX::setsid() < 0) {
print "Could not create new session\n";
exit -1;
@@ -1586,7 +1601,7 @@
=head1 KillThemAll
Signal handler that kills all children by sending them a
-SIGINT. Responds to sigint and sigterm.
+SIGHUP. Responds to sigint and sigterm.
=cut
@@ -1598,13 +1613,12 @@
Debug(2, "Killing lonc for $serving pid = $pid");
ShowStatus("Killing lonc for $serving pid = $pid");
Log("CRITICAL", "Killing lonc for $serving pid = $pid");
- kill('INT', $pid);
- delete($ChildeHash{$pid});
+ kill 'QUIT' => $pid;
+ delete($ChildHash{$pid});
}
my $execdir = $perlvar{'lonDaemons'};
unlink("$execdir/logs/lonc.pid");
- ShowStatus("Killing the master process");
- Log("CRITICAL", "Killing the master process.");
+
}
=pod
@@ -1617,7 +1631,8 @@
sub Terminate {
KillThemAll;
- exit;
+ Log("CRITICAL","Master process exiting");
+ exit 0;
}
=pod