[Koha-bugs] [Bug 18855] Fines cronjob can cause duplicate fines if run during active circulation

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Mar 7 18:38:58 CET 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18855

--- Comment #18 from Michael Hafen <michael.hafen at washk12.org> ---
Here's the test plan from the patch file:

Test plan:
1. find an overdue fine near the end of the list of overdue fines that
   cronjobs/fines.pl will be considering.
2. start cronjobs/fines.pl.
3. immediately check in the overdue book.
4. once fines.pl is finished observe that a duplicate overdue fine has been
   created on the patrons account.

5. apply patch.
6. repeat 1 - 4 and observe that the duplicate fine was not created.

Re: your comment (I replied to the email, but don't see it here):

Yes, that would be normal operation. The fine for the issue is identified by
being unreturned. If a book is renewed it's fine is returned, and if it becomes
overdue again the UpdateFine call will create the new one.
The bug is if an overdue book is returned or renewed while the script is
running, but before the script has processed that issue, then it's fine will be
returned, but the script still called UpdateFine, so another fine is created
since it couldn't find the one that was just changed to returned.
I've changed the script to check the issue before calling UpdateFine, and skip
the call this time if the issue (due date) changed to avoid the duplicate fine.
There is still a very narrow window where UpdateFine gets called and at the
same time the fine is changed to returned, but I think that chance is small
enough to overlook. The alternate would be to lock the tables before calling
UpdateFine, but that would slow down the circulation desk while the fines
script runs, which would probably bring complaints.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list