cron job went wild

From: sv650@macysadv.com
Date: Fri Jan 10 2003 - 17:01:11 EST


Hi Sun managers:
   I am trying to find out what caused my cron daemon to go nuts on my E250
(Solaris 2.8 108528-12)system. It was consuming over 90% of CPU. I also
realize that my swap size has deminished from 500MG to 17MG.

df -k output
/dev/dsk/c0t0d0s0 490097 115095 325993 27% /
/dev/dsk/c0t0d0s5 3579989 3238907 305283 92% /usr
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
mnttab 0 0 0 0% /etc/mnttab
/dev/dsk/c0t0d0s4 482824 276386 158156 64% /var
swap 8784 8 8776 1% /var/run
swap 30928 22152 8776 72% /tmp
/dev/dsk/c0t0d0s6 3579989 1772031 1772159 50% /opt

partition table, s1 is the swap
Part Tag Flag Cylinders Size Blocks
  0 root wm 293 - 583 510.24MB (291/0/0) 1044981
  1 swap wu 0 - 292 513.75MB (293/0/0) 1052163
  2 backup wm 0 - 4923 8.43GB (4924/0/0) 17682084
  3 unassigned wm 0 0 (0/0/0) 0
  4 var wm 584 - 869 501.48MB (286/0/0) 1027026
  5 usr wm 870 - 2894 3.47GB (2025/0/0) 7271775
  6 unassigned wm 2895 - 4919 3.47GB (2025/0/0) 7271775
  7 unassigned wm 0 0 (0/0/0) 0

Here's the truss output of cron.
181: fstat64(3, 0xFFBEFB48) = 0
181: alarm(1) = 0
181: wait() Err#10 ECHILD
181: alarm(0) = 1
181: fstat64(3, 0xFFBEFA48) = 0
181: time() = 1042232960
181: fstat64(3, 0xFFBEFB48) = 0
181: alarm(1) = 0
181: wait() Err#10 ECHILD
181: alarm(0) = 1
And just keep repeating for next 17000 lines. The number '1042232960' increase
every thousand of lines or so.

What does it mean? How can I find what caused the swap volume shrinkage.
System was working fine until I implete a script in crontab last week, but the
problem could be accumulation of little memory leak by other programs over the
past 338 days that the machine was running.

Thank you,
Mark

p.s. Here's a copy of script I wrote. It basically opens connection to two
host, and gather some information provided by the server and build them into
HTML pages.

#!/usr/bin/perl
use Socket;

# Write basic html headers
# Two Parameters:
# 1. type
# 2. filehandle to write to
sub writeHTML {
   ($type, $file) = @_;
   if ($type eq 'header'){
      print $file "<head><meta http-equiv=\"expires\" CONTENT=\"Wed, 26 Feb
1997 08:21:57 GMT\"></head>";
      print $file "<body topmargin=0 rightmargin=0 leftmargin=0>\n";
      print $file "<table width=98% align=left border=0 cellpadding=0
cellspacing=0>\n";

   }

   if ($type eq 'footer' ){
      print $file "</table>\n";
      print $file "</body>\n";

   }

}
my ($remote,$port, $iaddr, $paddr, $proto, $line);

# Open all the necessary files.
$outDIR = "/usr/local/apache/htdocs/printers";
#$outDIR = "/opt/mark/html";

@printers = (Xante3G_One, Xante3G_Two, Xante3G_Three, Xante3G_Four, NewsProof,
Fashion3G, PS3, FieryXJOne, FieryXJTwo);
#initialize printer counter hash
foreach $printer (@printers){
   $printerCounter{$printer} = 0;
}

# Write HTML header to each file
foreach $printer (@printers){
   open($printer, "> $outDIR/$printer" . ".html");
   writeHTML("header",$printer);
}

# Open history file
open(HISTORY, ">$outDIR/history");

# Open status summary file
open(SUMMARY, "> $outDIR/statSum.html");
#writeHTML("header", SUMMARY);
print SUMMARY "<head><meta http-equiv=\"expires\" CONTENT=\"Wed, 26 Feb 1997
08:21:57 GMT\"><meta http-equiv=\"refresh\" content=\"60\"></head>";
print SUMMARY "<body topmargin=0 rightmargin=0>\n";
print SUMMARY "<table width=100% border=0>\n";

# The Following Print to the Summary is the MOTD.
# Change to refect new changes.
print SUMMARY "
if you see paper jam or paper out in any of the <br>
printers, please call Mike Fish @ 4133 or Luis Cadilla @ 5616.
<br>
If any function in this website doesn't work, please<br>
call Mark Lin @ 5664.<br>";
print SUMMARY "<br><tr><td colspan=3>Status Summary</td></tr>";
print SUMMARY "<tr><td>Printer</td><td>Status</td><td># of Jobs</td></tr>\n";
print SUMMARY "<tr><td colspan=3><hr></td></tr>\n";

@hosts = (boris,natasha);

foreach $host (@hosts){

$remote = $host;
$port = 2346; # random port
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
   die "No port" unless $port;
$iaddr = inet_aton($remote) || die "no host: $remote";
$paddr = sockaddr_in($port, $iaddr);

$proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
connect(SOCK, $paddr) || die "close: $host $!\n";

send (SOCK,"services\n", h);
send (SOCK,"exit\n", h);

$color = 1;
# Getting information from servers
while (defined($line = <SOCK>)) {
   chomp($line);
   if ($line =~ m/exit now/){
      last;
   }
   #in this case, x = rip Name, y = title, z = id, z1 = time
   if ($line =~ m/^queue/){
        ($type, $x, $y, $z, $z1) = split (/\|\|/, $line);
        if ($x ne $oldPrinter){
           $color = 1;
        }
        if ($color == 1){
           print $x "<tr bgcolor=#efefef><td width=25% valign=top>$z1</td><td
width=50% valign=top>$y</td><td valign=top>$z</td></tr>\n";

           $color=0;
        }
        else{
           print $x "<tr><td width=25% valign=top>$z1</td><td width=50%
valign=top>$y</td><td valign=top>$z</td></tr>\n";

           $color=1;
        }
        $oldPrinter = $x;
        $printerCounter{$x} += 1;
   }

   if ($line =~ m/^status/){
      ($type, $x, $y, $z, $z1) = split (/\|\|/, $line);
      if ($y =~ m/paper (jam|out)/){
         $status = "<font color =red>Paper $1</font>. Please call Mike Fish
and let them know $x is down.\n";
      }
      elsif ($y =~ m/disabled/){
         $status = "<font color=red>Printer is disabled</font>.\n";
      }
      elsif ($y =~ m/low toner/){
         $status = "<font color=red>LOW TONER</font>.\n";
      }
      elsif ($y =~ m/connect failed/){
         $status = "<font color=red>Failing to connnect to printer</font>.
Call Mark @ 5664\n";
      }
      else {
         $status = "<b>Normal</b>\n";
      }

      print $x "<tr><td colspan = 3>";
      print SUMMARY "<tr><td width=20%>";
  
      print $x "<hr>\nStatus:<br>$status <br>\n";
      print SUMMARY "$x</td><td width=20%> $status</td><td>$printerCounter{$x}
\n";
      print $x "</tr></td>";
      print SUMMARY "</tr></td>";
   }

   # Write to history file for fugure search
   if ($line =~ m/^history/){
# ($type, $x, $y, $z, $z1, $z2, $z3) = split (/\|\|/, $line);
# print HISTORY "$x||$y||$z||$z1||$z2||$z4\n";
       print HISTORY "$line\n";
   }
}
close (SOCK) || die "close: $!";
}

foreach $printer (@printers){
   writeHTML("footer", $printer);
   close ($printer);
}
close(HISTORY);
writeHTML("footer", SUMMARY);
close(SUMMARY);

exit;
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:25:34 EDT