From 8e854c6a4edafe506780573fafe35c5e647a3e58 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Wed, 9 Jan 2013 16:20:39 -0500 Subject: [PATCH] LP #1075167: Serials: Avoid infinite loop in holdings summarization MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When receiving items with unworkable combinations of holdings and patterns, the holdings summarization code can get stuck in an infinite loop. This solution prevents that, sparing the open-ils.serial process and server resources, although it doesn't help the user out. It will take further examination of the problem and reëvalution of how we deal with problems reported by OpenILS::Utils::MFHD to help the user avoid or resolve these situations. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Dan Wells --- Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm | 3 +++ Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm index 309f9fe02b..2bf94d430d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm @@ -405,6 +405,9 @@ sub get_compressed_holdings { } else { push(@comp_holdings, $curr_holding); while ($runner le $holding) { + # Here is where we used to get stuck in an infinite loop + # until the "Don't know how to deal with frequency" was + # elevated from a carp to a croak. $runner->increment; } $curr_holding = $holding->clone; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm index 297d0ab661..bec26771b3 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm @@ -475,7 +475,7 @@ sub next_chron { if (!defined($freq)) { carp "Undefined frequency in next_chron!"; } elsif (!MFHD::Date::can_increment($freq)) { - carp "Don't know how to deal with frequency '$freq'!"; + croak "Don't know how to deal with frequency '$freq'!"; } else { # One of the standard defined issue frequencies @new = MFHD::Date::incr_date($freq, @cur); -- 2.11.0