From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Thu, 8 Jul 2010 18:35:15 +0000 (+0000)
Subject: add sig handler back in for alarm.  log error when read times out from alarm
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ddb3c834e48a995e412bbe5834a8b1c03f13e7f5;p=contrib%2FConifer.git

add sig handler back in for alarm.  log error when read times out from alarm

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16888 dcc99617-32d9-48b4-a31d-7c20da2025e4
---

diff --git a/Open-ILS/src/support-scripts/marc_stream_importer.pl b/Open-ILS/src/support-scripts/marc_stream_importer.pl
index 26b180b374..f9546b8b7a 100755
--- a/Open-ILS/src/support-scripts/marc_stream_importer.pl
+++ b/Open-ILS/src/support-scripts/marc_stream_importer.pl
@@ -325,11 +325,19 @@ sub process_request {   # The core Net::Server method
     $logger->info("stream parser received contact");
     my $data;
     eval {
+        local $SIG{ALRM} = sub { die "alarm\n" };
         alarm $wait_time; # prevent accidental tie ups of backend processes
         $data = <STDIN>;
         alarm 0;
     };
+
+    if($@) {
+        $logger->error("reading from STDIN failed or timed out: $@");
+        return;
+    } 
+
     $logger->info("stream parser read " . length($data) . " bytes");
+
     if ($real_opts->{noqueue}) {
         old_process_batch_data($data);
     } else {