[Orca-users] Re: Orcallator Problem with the lock directory.

Blair Zajac blair at akamai.com
Mon Feb 5 15:34:58 PST 2001


Philippe,

I think the problem occurs when STDOUT and/or STDERR is piped to a
process, such as less, and the process exits before Orca does.  In
this case, Orca would not catch the SIGPIPE and it would be aborted
without cleaning up the locking directory.

Does this description fit with how Orca was run on your system?

Apply the following patch to Orca and this should help.

Regards,
Blair

PS Also apply the other patch to fix another issue with Orca 0.26.

Philippe Benchemoul wrote:
> 
> Oups !!
> 
> Yes I'am, Excuse me.
> 
> Thanks.
> 
> "Spike Burkhardt (MIS)" wrote:
> 
> > Hi all,
> >
> >   Philippe, are you referring to the Orca 0.26 release?
> >
> > spike burkhardt
> >
> > -----Original Message-----
> > From: Philippe Benchemoul [mailto:pbenchem at wanadoo.com]
> > Sent: Tuesday, October 10, 2000 2:57 AM
> > To: orca-users at egroups.com
> > Subject: [orca-users] Orcallator Problem with the lock directory.
> >
> > Hi everybody,
> >
> > Orcallator seem to have a problem with the lock directory after a long
> > time it was running.
> > I use the Orca 2.0.6 release, and I have to delete the lock directory
> > and rerun orca to
> > have the rights statistics on the WEB .
> >
> > Thanks in advance for your help.
> >
> 
> -------------------------- eGroups Sponsor -------------------------~-~>
> Restaurants, Movies, Weather, Traffic & More!
> Access Tellme from any phone.  For more info visit:
> http://click.egroups.com/1/9534/13/_/804404/_/971248341/
> ---------------------------------------------------------------------_->
-------------- next part --------------
diff -ru ../Z/orca-0.26/src/orca.pl.in ./src/orca.pl.in
--- ../Z/orca-0.26/src/orca.pl.in	Thu Mar  9 14:49:59 2000
+++ ./src/orca.pl.in	Mon Feb  5 15:18:36 2001
@@ -85,8 +85,9 @@
 
 # Install signal handlers to clean up.
 $SIG{INT}     = \&catch_signal;
+$SIG{PIPE}    = \&catch_signal;
 $SIG{TERM}    = \&catch_signal;
-$SIG{__DIE__} = \&catch_signal;
+$SIG{__DIE__} = \&catch_die;
 
 if ($opt_verbose) {
   print "Orca version $ORCA_VERSION using RRDs version $RRDs::VERSION.\n";
@@ -102,29 +103,51 @@
 # This is set to 1 if the locking directory should be removed.
 my $rmdir_locking_directory;
 
+# This cleans up any leftover temporary files.  In certain
+# circumstances, such as when Orca receives a SIGPIPE, then assume
+# that STDOUT and STDERR are closed and do not print any messages so
+# that Orca can properly clean up.  If Orca prints when STDOUT and/or
+# STDERR or closed, then it will hang.
 sub clean_up_and_quit {
-  # Print some statistics about running.
-  &running_stats;
+  my $can_print = shift;
+  my $message   = shift;
+
+  $can_print = 1 unless defined $can_print;
 
   if ($rmdir_locking_directory and
       $locking_directory and
       -d $locking_directory) {
-    rmdir($locking_directory) or
-      warn "$0: cannot rmdir `$locking_directory': $!\n";
+    unless (rmdir($locking_directory)) {
+      if ($can_print) {
+        warn "$0: cannot rmdir `$locking_directory': $!\n";
+      }
+    }
+  }
+
+  # Print the given message and any running statistics.
+  if ($can_print) {
+    print $message if $message;
+    &running_stats;
   }
+
   exit 0;
 }
 
+# Catch any die messages.
+sub catch_die {
+  my $message = shift;
+  clean_up_and_quit(1, $message);
+}
+
+# Catch any signals.  Treat SIGPIPE specially to instruct Orca to not
+# print any more messages to STDOUT or STDERR, since these file
+# descriptors may have closed if they were attached to a process that
+# exited.
 sub catch_signal {
-  my $signal = shift;
-  chomp($signal);
-  $signal =~ s/\.+$//;
-  if ($signal =~ /$0/o) {
-    print STDERR "$signal.\n";
-  } else {
-    print STDERR "$0: caught signal $signal.\n";
-  }
-  clean_up_and_quit;
+  my $signal    = shift;
+  my $can_print = $signal !~ /PIPE/;
+  my $message   = "$0: caught signal $signal.\n";
+  clean_up_and_quit($can_print, $message);
 }
 
 sub main {
-------------- next part --------------
--- ../orca-0.26/src/orca.pl.in	Thu Mar  9 14:49:59 2000
+++ src/orca.pl.in	Mon Feb  5 11:19:09 2001
@@ -965,17 +965,23 @@
 
     # Create a new list of filenames sorted by subgroup name and
     # inside each subgroup sorted using the filename_compare
-    # configuration option function or by the Perl cmp function.  This
-    # will cause the created plots to appear in subgroup order.  The
-    # compare subroutine expects the input in the $a and $b package
-    # variables.  Since the subroutine was eval'ed in the Orca::Config
-    # package, the sort subroutine needs be in that package.
+    # configuration file function or by the default compare function
+    # that uses cmp to compare filenames.  This will cause the created
+    # plots to appear in subgroup order.  Note that the FIDs are not
+    # being sorted, but the filename the FID references.
+    #
+    # The compare subroutine expects the input in the $a and $b
+    # package variables and since the compare subroutine was eval'ed
+    # in the Orca::Config package, the compare subroutine needs be run
+    # in Orca::Config.  Also, since sort cannot be passed a reference
+    # to a sorting subroutine stored in a hash (i.e. sort $a{b} @c),
+    # use a temporary variable.
     @fids = ();
     {
-      local *Orca::Config::fc = $config_groups{$group_name}{filename_compare};
+      package Orca::Config;
+      my $fc = $config_groups{$group_name}{filename_compare};
       foreach my $subgroup (sort keys %tmp_fids_by_subgroup) {
-        push(@fids,
-             sort Orca::Config::fc @{$tmp_fids_by_subgroup{$subgroup}});
+        push(@fids, sort $fc @{$tmp_fids_by_subgroup{$subgroup}});
       }
     }
 


More information about the Orca-users mailing list