[LON-CAPA-cvs] cvs: loncom / loncron /init.d loncontrol /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Sun Sep 20 14:31:44 EDT 2015


raeburn		Sun Sep 20 18:31:44 2015 EDT

  Modified files:              
    /loncom	loncron 
    /loncom/init.d	loncontrol 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - Eliminate "caching of id  ... failed" messages in lonnet.log when starting 
    or restarting loncontrol.
    - Do not attempt to use memcache to store dns:/adm/dns/hosts, dns:/adm/dns/domain
      and iphost:iphost, when memcached is not running in this particular situation. 
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.102 loncom/loncron:1.103
--- loncom/loncron:1.102	Thu May 28 23:50:15 2015
+++ loncom/loncron	Sun Sep 20 18:31:21 2015
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.102 2015/05/28 23:50:15 raeburn Exp $
+# $Id: loncron,v 1.103 2015/09/20 18:31:21 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -921,9 +921,23 @@
     }
 
 # -------------------------------------------- Force reload of host information
-    &Apache::lonnet::load_hosts_tab(1);
-    &Apache::lonnet::load_domain_tab(1);
-    &Apache::lonnet::get_iphost(1);
+    my $nomemcache;
+    if ($justcheckdaemons) {
+        $nomemcache=1;
+        my $memcachepidfile="$perlvar{'lonDaemons'}/logs/memcached.pid";
+        my $memcachepid;
+        if (-e $memcachepidfile) {
+            my $memfh=IO::File->new($memcachepidfile);
+            $memcachepid=<$memfh>;
+            chomp($memcachepid);
+            if ($memcachepid =~ /^\d+$/ && kill 0 => $memcachepid) {
+                undef($nomemcache);
+            }
+        }
+    }
+    &Apache::lonnet::load_hosts_tab(1,$nomemcache);
+    &Apache::lonnet::load_domain_tab(1,$nomemcache);
+    &Apache::lonnet::get_iphost(1,$nomemcache);
 
 # ----------------------------------------- Force firewall update for lond port  
 
Index: loncom/init.d/loncontrol
diff -u loncom/init.d/loncontrol:1.43 loncom/init.d/loncontrol:1.44
--- loncom/init.d/loncontrol:1.43	Sun May 15 01:10:02 2011
+++ loncom/init.d/loncontrol	Sun Sep 20 18:31:33 2015
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: loncontrol,v 1.43 2011/05/15 01:10:02 raeburn Exp $
+# $Id: loncontrol,v 1.44 2015/09/20 18:31:33 raeburn Exp $
 #
 # The LearningOnline Network with CAPA
 #
@@ -121,7 +121,7 @@
             if ($daemon eq 'lonc') { $killallname='loncnew'; }
             &stop_daemon($daemon,$killallname);
         }
-        %iphost = &Apache::lonnet::get_iphost();
+        %iphost = &Apache::lonnet::get_iphost('',1);
         my $firewall_result =
             &LONCAPA::Firewall::firewall_close_port($iptables,\@fw_chains,
                                              $lond_port,\%iphost,[$lond_port]);
@@ -155,7 +155,7 @@
         }
         &clean_sockets();
     } elsif ($command eq "start") {
-        %iphost = &Apache::lonnet::get_iphost();
+        %iphost = &Apache::lonnet::get_iphost('',1);
         my $firewall_result = 
             &LONCAPA::Firewall::firewall_open_port($iptables,\@fw_chains,$lond_port,\%iphost,[$lond_port]);
         if (($firewall_result eq 'ok') || ($firewall_result eq 'inactive firewall')) {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1292 loncom/lonnet/perl/lonnet.pm:1.1293
--- loncom/lonnet/perl/lonnet.pm:1.1292	Mon Sep 14 13:45:36 2015
+++ loncom/lonnet/perl/lonnet.pm	Sun Sep 20 18:31:43 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1292 2015/09/14 13:45:36 raeburn Exp $
+# $Id: lonnet.pm,v 1.1293 2015/09/20 18:31:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -12395,8 +12395,8 @@
     }
 
     sub load_domain_tab {
-	my ($ignore_cache) = @_;
-	&get_dns('/adm/dns/domain',\&parse_domain_tab,$ignore_cache);
+	my ($ignore_cache,$nocache) = @_;
+	&get_dns('/adm/dns/domain',\&parse_domain_tab,$ignore_cache,$nocache);
 	my $fh;
 	if (open($fh,"<".$perlvar{'lonTabDir'}.'/domain.tab')) {
 	    my @lines = <$fh>;
@@ -12482,8 +12482,8 @@
     }
 
     sub load_hosts_tab {
-	my ($ignore_cache) = @_;
-	&get_dns('/adm/dns/hosts',\&parse_hosts_tab,$ignore_cache);
+	my ($ignore_cache,$nocache) = @_;
+	&get_dns('/adm/dns/hosts',\&parse_hosts_tab,$ignore_cache,$nocache);
 	open(my $config,"<$perlvar{'lonTabDir'}/hosts.tab");
 	my @config = <$config>;
 	&parse_hosts_tab(\@config);
@@ -12505,7 +12505,8 @@
     }
 
     sub all_names {
-	&load_hosts_tab() if (!$loaded);
+        my ($ignore_cache,$nocache) = @_;
+	&load_hosts_tab($ignore_cache,$nocache) if (!$loaded);
 
 	return %name_to_host;
     }
@@ -12627,7 +12628,7 @@
     }
     
     sub get_iphost {
-	my ($ignore_cache) = @_;
+	my ($ignore_cache,$nocache) = @_;
 
 	if (!$ignore_cache) {
 	    if (%iphost) {
@@ -12651,7 +12652,7 @@
 	    %old_name_to_ip = %{$ip_info->[1]};
 	}
 
-	my %name_to_host = &all_names();
+	my %name_to_host = &all_names($ignore_cache,$nocache);
 	foreach my $name (keys(%name_to_host)) {
 	    my $ip;
 	    if (!exists($name_to_ip{$name})) {
@@ -12676,9 +12677,11 @@
 	    }
 	    push(@{$iphost{$ip}},@{$name_to_host{$name}});
 	}
-	&do_cache_new('iphost','iphost',
-		      [\%iphost,\%name_to_ip,\%lonid_to_ip],
-		      48*60*60);
+        unless ($nocache) {
+	    &do_cache_new('iphost','iphost',
+		          [\%iphost,\%name_to_ip,\%lonid_to_ip],
+		          48*60*60);
+        }
 
 	return %iphost;
     }




More information about the LON-CAPA-cvs mailing list