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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 13 Mar 2003 21:01:52 -0000


albertel		Thu Mar 13 16:01:52 2003 EDT

  Modified files:              
    /loncom	lond 
  Log:
  - prevent parent process from getting stuck
  
  
Index: loncom/lond
diff -u loncom/lond:1.112 loncom/lond:1.113
--- loncom/lond:1.112	Fri Mar  7 10:04:00 2003
+++ loncom/lond	Thu Mar 13 16:01:52 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.112 2003/03/07 15:04:00 matthew Exp $
+# $Id: lond,v 1.113 2003/03/13 21:01:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -263,17 +263,25 @@
         } 
     }
     sleep 5;
+    $SIG{ALRM} = sub { die "timeout" };
+    $SIG{__DIE__} = 'DEFAULT';
     foreach (sort keys %children) {
         unless (-e "$docdir/lon-status/londchld/$_.txt") {
+          eval {
+            alarm(300);
 	    &logthis('Child '.$_.' did not respond');
 	    kill 9 => $_;
 	    $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}";
 	    $subj="LON: $perlvar{'lonHostID'} killed lond process $_";
 	    my $result=`echo 'Killed lond process $_.' | mailto $emailto -s '$subj' > /dev/null`;
 	    $execdir=$perlvar{'lonDaemons'};
-	    $result=`/bin/cp $execdir/logs/lond.log $execdir/logs/lond.log.$_`
+	    $result=`/bin/cp $execdir/logs/lond.log $execdir/logs/lond.log.$_`;
+	    alarm(0);
+	  }
         }
     }
+    $SIG{ALRM} = 'DEFAULT';
+    $SIG{__DIE__} = \&cathcexception;
 }
 
 # --------------------------------------------------------------------- Logging