[Bug 36797] New: Record with 1000+ holds and unique priorities causes a 500 error
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Bug ID: 36797 Summary: Record with 1000+ holds and unique priorities causes a 500 error Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Hold requests Assignee: koha-bugs@lists.koha-community.org Reporter: lucas@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com To recreate: 1. Find a record that has 1000 non-waiting holds with different priorities. 2. Try loading the reserve page for that record ( /reserve/request.pl?biblionumber=X ) 4. Error: Template process failed: undef error - WHILE loop terminated (> 1000 iterations) This looks to be because of TT 'While' loop in holds_table.inc: [% BLOCK priority_dropdown %] [%- SET loop_priority = 1 -%] [%- WHILE loop_priority <= last_priority -%] [%- IF this_priority == loop_priority -%] <option value="[% loop_priority | html %]" selected="selected">[% loop_priority | html %]</option> [%- ELSE -%] <option value="[% loop_priority | html %]">[% loop_priority | html %]</option> [%- END -%] [%- loop_priority = loop_priority + 1- %] [%- END -%] [% END %] TT documentation states that it will terminate a WHILE loop larger than 1000 to prevent runaways: https://template-toolkit.org/docs/manual/Directives.html#section_WHILE -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 --- Comment #1 from Lucas Gass <lucas@bywatersolutions.com> --- If you're using k-t-d to test you can use this script: https://github.com/ricofreak/handy_koha_scripts/blob/main/make_holds.pl After you run it and have at least 1000 holds I then did the following inside k-t-d: sudo koha-mysql kohadev update reserves set priority = reserve_id; -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |lucas@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|lucas@bywatersolutions.com |koha-bugs@lists.koha-commun | |ity.org --- Comment #2 from Lucas Gass <lucas@bywatersolutions.com> --- Maybe this can just be a FOREACH loop? It won't die after 1000 iterations. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |lucas@bywatersolutions.com |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 --- Comment #3 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 166302 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=166302&action=edit Bug 36797: Change WHILE loop into FOREACH To test: 1. Find a record that has 1000 non-waiting holds with different priorities. 2. Try loading the reserve page for that record ( /reserve/request.pl?biblionumber=X ) 3. Error: Template process failed: undef error - WHILE loop terminated (> 1000 iterations) 4. APPLY PATCH 5. Try again, this time the page should load. 6. Try testing on a record with less than 1000 holds, making sure the priorities are still set right. 7. Make sure you can change your priorities and everything works right. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #166302|0 |1 is obsolete| | --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 166327 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=166327&action=edit Bug 36797: Change WHILE loop into FOREACH To test: 1. Find a record that has 1000 non-waiting holds with different priorities. 2. Try loading the reserve page for that record ( /reserve/request.pl?biblionumber=X ) 3. Error: Template process failed: undef error - WHILE loop terminated (> 1000 iterations) 4. APPLY PATCH 5. Try again, this time the page should load. 6. Try testing on a record with less than 1000 holds, making sure the priorities are still set right. 7. Make sure you can change your priorities and everything works right. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Status|Needs Signoff |Signed Off --- Comment #5 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Simple patch converting WHILE to FOREACH.. works as expected. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- oof.. Signing off I mean ;) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #166327|0 |1 is obsolete| | --- Comment #7 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 166607 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=166607&action=edit Bug 36797: Change WHILE loop into FOREACH To test: 1. Find a record that has 1000 non-waiting holds with different priorities. 2. Try loading the reserve page for that record ( /reserve/request.pl?biblionumber=X ) 3. Error: Template process failed: undef error - WHILE loop terminated (> 1000 iterations) 4. APPLY PATCH 5. Try again, this time the page should load. 6. Try testing on a record with less than 1000 holds, making sure the priorities are still set right. 7. Make sure you can change your priorities and everything works right. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |24.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 --- Comment #8 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Status|Pushed to main |Pushed to stable Version(s)|24.05.00 |24.05.00,23.11.06 released in| | --- Comment #9 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.11.x for 23.11.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 --- Comment #10 from Lucas Gass <lucas@bywatersolutions.com> --- This is going to require some rebasing for 23.05.x, I'll come back to do so ASAP. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|martin.renvoize@ptfs-europe | |.com | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36797 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org