[Bug 32442] New: Invalid Template Toolkit in notices can cause broader errors
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Bug ID: 32442 Summary: Invalid Template Toolkit in notices can cause broader errors Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Notices Assignee: koha-bugs@lists.koha-community.org Reporter: lucas@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org I have been noticing something while testing notices lately that I wanted to point out and see if anyone else can recreate, this is happening for me in KTD: To recreate: 1. Go to any notice and create some invalid Template Toolkit: [% IF ( 1 == 1 %] test [% END %] 2. Save and continue 3. Notice the Template Toolkit error: This is good. 3. Correct the error: [% IF ( 1 == 1 ) %] test [% END %] 4. Now save again. This time I see the Template Toolkit error like: DBIx::Class::Storage::DBI::mysql::_exec_svp_rollback(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_0 does not exist at /kohadevbox/koha/C4/Letters.pm line 1624 5. Save anyways 6. Logout of Koha and attempt to log back in: It explodes with this error: {UNKNOWN}: Transaction aborted: DBIx::Class::Storage::DBI::mysql::_exec_svp_release(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_4 does not exist at /kohadevbox/koha/Koha/Object.pm line 170 . Rollback failed: DBIx::Class::Storage::DBI::mysql::_exec_svp_rollback(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_3 does not exist at /kohadevbox/koha/Koha/Patron.pm line 363 at /kohadevbox/koha/Koha/Patron.pm line 363 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Invalid Template Toolkit in |Invalid Template Toolkit in |notices can cause broader |notices can cause errors |errors | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal -- 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=32442 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=28739 Depends on| |31211, 31373 CC| |nick@bywatersolutions.com --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- The issue seems to be combination of the try/catch (bug 31211) with the nested transaction (bug 28739) - when we fail we never rollback the transaction Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31211 [Bug 31211] Check slips and notices for valid Template Toolkit and report errors https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31373 [Bug 31373] Notice template validation is missing INCLUDE_PATH -- 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=32442 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com, kyle.m.hall@gmail.com, | |m.de.rooy@rijksmuseum.nl, | |martin.renvoize@ptfs-europe | |.com Severity|normal |major -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 --- Comment #2 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 144564 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144564&action=edit Bug 32442: Add tests -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 --- Comment #3 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 144565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144565&action=edit Bug 32442: (bug 28739 follow-up) Ensure txn is rollbacked If the TT process call is returning false and so the croak is raised, then the txn is not rollbacked and the txn is not commited either. We need to ensure the txn will be correctly rollbacked. Test plan: 1. Go to any notice and create some invalid Template Toolkit: [% IF ( 1 == 1 %] test [% END %] 2. Save and continue 3. Logout of Koha and attempt to log back in => Without this patch you got Transaction aborted: DBIx::Class::Storage::DBI::mysql::_exec_svp_release(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_4 does not exist at /kohadevbox/koha/Koha/Object.pm line 170 . Rollback failed: DBIx::Class::Storage::DBI::mysql::_exec_svp_rollback(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_3 does not exist at /kohadevbox/koha/Koha/Patron.pm line 363 at /kohadevbox/koha/Koha/Patron.pm line 363 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 => With this patch applied the login works successfully QA Note: The test is not testing that the txn is rolledback, I didn't manage to test that. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |jonathan.druart+koha@gmail. |ity.org |com -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |BLOCKED QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- QA: Looking here -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Failed QA --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Applied both patches, ran the test. Passed. Ran the test again: # Subtest: regression tests 1..8 DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry 'a_t_barcode' for key 'itembarcodeidx' at /usr/share/koha/Koha/Object.pm line 170 # No tests run! not ok 25 - No tests run for subtest "regression tests" # Failed test 'No tests run for subtest "regression tests"' # at t/db_dependent/Letters/TemplateToolkit.t line 1045. Checked my data: Lots of garbage items from the unit test in my database. This is not production ready yet :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 --- Comment #6 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Problem introduced by this patch? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #144564|0 |1 is obsolete| | Attachment #144565|0 |1 is obsolete| | --- Comment #7 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 144686 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144686&action=edit Bug 32442: Add tests 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=32442 --- Comment #8 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 144687 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144687&action=edit Bug 32442: (bug 28739 follow-up) Ensure txn is rollbacked If the TT process call is returning false and so the croak is raised, then the txn is not rollbacked and the txn is not commited either. We need to ensure the txn will be correctly rollbacked. Test plan: 1. Go to any notice and create some invalid Template Toolkit: [% IF ( 1 == 1 %] test [% END %] 2. Save and continue 3. Logout of Koha and attempt to log back in => Without this patch you got Transaction aborted: DBIx::Class::Storage::DBI::mysql::_exec_svp_release(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_4 does not exist at /kohadevbox/koha/Koha/Object.pm line 170 . Rollback failed: DBIx::Class::Storage::DBI::mysql::_exec_svp_rollback(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_3 does not exist at /kohadevbox/koha/Koha/Patron.pm line 363 at /kohadevbox/koha/Koha/Patron.pm line 363 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 => With this patch applied the login works successfully QA Note: The test is not testing that the txn is rolledback, I didn't manage to test that. 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=32442 --- Comment #9 from Nick Clemens <nick@bywatersolutions.com> --- (In reply to Marcel de Rooy from comment #5)
This is not production ready yet :)
I was able to run multiple times with no problems - the test plan in staff interface worked as well -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Running the test adds barcodes to the table like: +---------------------+ | barcode | +---------------------+ | a_t_barcode | | another_t_barcode | | another_t_barcode_3 | | IROjihTVYw1IMlUDV4 | | msuHU5tofEXn | | NMhOFzbI7Yjf | | oTfqL7AeaoSq9tDTJWQ | | Pu2W1UbP7HAvqZkum | | sblzCdKniw_bfJubrZA | | SXpFbuhE5TtTTq | | twTvJHKIkgDCZqh9R | | U8T51kYicLV4_JP | | UmNgCvommVa | | vf_sVPEcyM861c9 | | wY_QRsZyUSpFc | +---------------------+ This might not be the direct cause of this patch. But we should fix it here now where we are also dealing with the rollback etc. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #11 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Marcel de Rooy from comment #10)
Running the test adds barcodes to the table like:
+---------------------+ | barcode | +---------------------+ | a_t_barcode | | another_t_barcode | | another_t_barcode_3 | | IROjihTVYw1IMlUDV4 | | msuHU5tofEXn | | NMhOFzbI7Yjf | | oTfqL7AeaoSq9tDTJWQ | | Pu2W1UbP7HAvqZkum | | sblzCdKniw_bfJubrZA | | SXpFbuhE5TtTTq | | twTvJHKIkgDCZqh9R | | U8T51kYicLV4_JP | | UmNgCvommVa | | vf_sVPEcyM861c9 | | wY_QRsZyUSpFc | +---------------------+
This might not be the direct cause of this patch. But we should fix it here now where we are also dealing with the rollback etc.
I don't recreate and, if true, I don't think it should be done on this bug report. That sounds something different. select count(*) from items; # 961 prove t/db_dependent/Letters/TemplateToolkit.t t/db_dependent/Letters/TemplateToolkit.t .. ok All tests successful. select count(*) from items; # 961 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Running prove with test gave no additional items for me too. Running the script from the commandline itself does: | a_t_barcode | | another_t_barcode | | another_t_barcode_3 | | BMFPNewTkRQ7 | | CSNGMjPP6jg | | XdvEtgyDT2vFo9xLw | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- It is probably the LOCK in SendCirculationAlert.. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch 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=32442 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #144686|0 |1 is obsolete| | Attachment #144687|0 |1 is obsolete| | --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 145862 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=145862&action=edit Bug 32442: Add tests Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 --- Comment #15 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 145863 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=145863&action=edit Bug 32442: (bug 28739 follow-up) Ensure txn is rollbacked If the TT process call is returning false and so the croak is raised, then the txn is not rollbacked and the txn is not commited either. We need to ensure the txn will be correctly rollbacked. Test plan: 1. Go to any notice and create some invalid Template Toolkit: [% IF ( 1 == 1 %] test [% END %] 2. Save and continue 3. Logout of Koha and attempt to log back in => Without this patch you got Transaction aborted: DBIx::Class::Storage::DBI::mysql::_exec_svp_release(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_4 does not exist at /kohadevbox/koha/Koha/Object.pm line 170 . Rollback failed: DBIx::Class::Storage::DBI::mysql::_exec_svp_rollback(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_3 does not exist at /kohadevbox/koha/Koha/Patron.pm line 363 at /kohadevbox/koha/Koha/Patron.pm line 363 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 => With this patch applied the login works successfully QA Note: The test is not testing that the txn is rolledback, I didn't manage to test that. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |23.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 --- Comment #16 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.05. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Jacob O'Mara <jacob.omara@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|23.05.00 |23.05.00,22.11.03 released in| | Status|Pushed to master |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 --- Comment #17 from Jacob O'Mara <jacob.omara@ptfs-europe.com> --- Nice work, thanks everyone! Pushed to 22.11.x for the next release. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32442 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |RESOLVED Resolution|--- |FIXED --- Comment #18 from Lucas Gass <lucas@bywatersolutions.com> --- Not needed in 22.05.x, no backport -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org