https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27707 Bug ID: 27707 Summary: Renewing doesn't work when renewal notices are enabled Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: joonas.kylmala@helsinki.fi QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Depends on: 26639 Renewing loans doesn't work for patrons who have enabled renewal notices to be sent to them. To reproduce: 1) Enable RenewalSendNotice 2) Add some email address to patron and select the email box from the message preference "Item checkout and renewal" in order to receive renewal emails. 3) Checkout 4 items to the patron (maybe 1 is enough not quite sure) 4) Try to renew the loans in intranet and notice the progress icon circles forever and in the plack-error.log you have following error:
DBIx::Class::Storage::DBI::mysql::_exec_svp_release(): DBI Exception: DBD::mysql::db do failed: SAVEPOINT savepoint_0 does not exist [for Statement "RELEASE SAVEPOINT savepoint_0"] at /usr/share/koha/lib/C4/Circulation.pm line 3590
This bug seems to have started happening after bug 26639 was merged, i.e. AUTO SAVEPOINT was enabled. I have found a workaround and possibly it is also a reasonable solution: In C4/Circulation.pm function SendCirculationAlert there is this comment:
# LOCK TABLES is not transaction-safe and implicitly commits any active transaction before attempting to lock the tables.
So basically if that comment is true (I have not verified) then it means that the transaction that has been put around the "LOCK TABLE message_queue READ" stuff is doing nothing. And here based on the error message we got in plack-error.log the problem is that we are trying to commit a non-existent transaction because as per the comment in the code calling LOCK TABLE already commited the transaction so there is no transaction left for us to commit manually in the end. To summarise we need to remove the two lines I think: $schema->storage->txn_begin; $schema->storage->txn_commit; Also why I think the above solution is reasonable is because otherwise we need to rethought the design here totally on how the digest messages are sent and maybe add a new is_digest db column and do the logic in the message sending script instead of "merging db rows". For more background on why the table locking was introduced see bug 15854. PS. I think this bug might affect check-in and checkouts, not totally sure. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26639 [Bug 26639] Turn auto_savepoint ON -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.