"Use of freed value in iteration" error during adjust to zero

Bug #1691563 reported by Jeff Davis
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Unassigned
3.0
Fix Released
Undecided
Unassigned

Bug Description

EG 2.12

During adjust to zero, we've seen occasional errors like this:

"Call to [open-ils.circ.money.billable_xact.adjust_to_zero] failed for session [...], thread trace [1]:
Use of freed value in iteration at /usr/local/share/perl/5.18.2/OpenILS/Application/Circ/CircCommon.pm line 807."

I don't have a test plan to consistently reproduce the error yet. However, the error message points to a foreach loop in the bill_payment_map_for_xact() function, in which the loop itself removes elements from the array which is being looped over. This is a problem in Perl:

http://perldoc.perl.org/perldiag.html#Use-of-freed-value-in-iteration

"You are not supposed to modify arrays while they are being iterated over. For speed and efficiency reasons, Perl internally does not do full reference-counting of iterated items, hence deleting such an item in the middle of an iteration causes Perl to see a freed value."

Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

Branch working/user/jeffdavis/lp1691563-freed-value-in-iteration has the kind of fix that I believe is needed here:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=commitdiff;h=577b0171

Changed in evergreen:
milestone: none → 2.12.2
tags: added: pullrequest
Changed in evergreen:
milestone: 2.12.2 → 2.12.3
Changed in evergreen:
milestone: 2.12.3 → 2.12.4
Changed in evergreen:
milestone: 2.12.4 → 2.12.5
Revision history for this message
Michele Morgan (mmorgan) wrote :

We have seen this same error on a 2.12.2 system when adjusting as a result of checking in a Lost item. Setting to Confirmed.

tags: added: billing
Changed in evergreen:
status: New → Confirmed
Revision history for this message
Mike Rylander (mrylander) wrote :

Picked into master and 2.12. Thanks, Jeff!

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.