[LON-CAPA-cvs] cvs: loncom / loncnew

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 05 Jan 2004 09:29:36 -0000


foxr		Mon Jan  5 04:29:36 2004 EDT

  Modified files:              
    /loncom	loncnew 
  Log:
  Add additional status output for SIGUSR1:
  - In the status file give the status of each of the connections as well
    as (implicitly) the connection count.
  - In the error file /home/httpd/perl/logs/lonc_error dump the state of each
    connection (depends on update to LondConnection.pm to redirect Dump to STDERR)
  
  
  The idea is that if you have some weird state in loncnew perhaps this will give enough information to diagnose this or at least get started.
  
  
  
  
Index: loncom/loncnew
diff -u loncom/loncnew:1.37 loncom/loncnew:1.38
--- loncom/loncnew:1.37	Tue Dec 16 11:12:19 2003
+++ loncom/loncnew	Mon Jan  5 04:29:36 2004
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # lonc maintains the connections to remote computers
 #
-# $Id: loncnew,v 1.37 2003/12/16 16:12:19 albertel Exp $
+# $Id: loncnew,v 1.38 2004/01/05 09:29:36 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -35,12 +35,12 @@
 #    - Add ability to create/negotiate lond connections (done).
 #    - Add general logic for dispatching requests and timeouts. (done).
 #    - Add support for the lonc/lond requests.          (done).
-#    - Add logging/status monitoring.
-#    - Add Signal handling - HUP restarts. USR1 status report.
+#    - Add logging/status monitoring.                    (done)
+#    - Add Signal handling - HUP restarts. USR1 status report. (done)
 #    - Add Configuration file I/O                       (done).
-#    - Add management/status request interface.
+#    - Add management/status request interface.         (done)
 #    - Add deferred request capability.                  (done)
-#    - Detect transmission timeouts.
+#    - Detect transmission timeouts.                     (done)
 #
 
 use strict;
@@ -261,7 +261,9 @@
 =cut
 sub SocketTimeout {
     my $Socket = shift;
-    
+    Log("WARNING", "A socket timeout was detected");
+    Debug(0, " SocketTimeout called: ");
+    $Socket->Dump();
     KillSocket($Socket);	# A transaction timeout also counts as
                                 # a connection failure:
     $ConnectionRetriesLeft--;
@@ -1342,6 +1344,20 @@
     my $fh = IO::File->new(">>$docdir/lon-status/loncstatus.txt");
     print $fh $$."\t".$RemoteHost."\t".$Status."\t".
 	$RecentLogEntry."\n";
+    #
+    #  Write out information about each of the connections:
+    #
+    print $fh "Active connection statuses: \n";
+    my $i = 1;
+    print STDERR  "================================= Socket Status Dump:\n";
+    foreach my $item (keys %ActiveConnections) {
+	my $Socket = $ActiveConnections{$item}->data;
+	my $state  = $Socket->GetState();
+	print $fh "Connection $i State: $state\n";
+	print STDERR "---------------------- Connection $i \n";
+	$Socket->Dump();
+	$i++;	
+    }
     $ConnectionRetriesLeft = $ConnectionRetries;
 }