https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35734
--- Comment #3 from Adolfo RodrÃguez Taboada <[email protected]> --- We hit this in production: an unrelated exception was raised inside the LOCK TABLE message_queue ... UNLOCK TABLES block of SendCirculationAlert, so UNLOCK TABLES never ran. With persistent connections (Plack), the table stayed locked on that worker's connection, every request that touched message_queue waited on it, and the staff interface and the OPAC went down. The same block is in C4::Reserves::_koha_notify_reserve (hold digests). The attached patch moves the block to a new method, C4::Message->enqueue_or_append, that locks the row of the patron (SELECT ... FOR UPDATE) in a transaction instead of the whole table: - Only concurrent notices for the same patron wait for each other. - The lock is released when the transaction ends, whatever happens; a failure is rolled back (to a savepoint if there is an enclosing transaction). - If the notice cannot be queued, the error is logged and the checkout, checkin or hold goes on. - The current lock does not even prevent the race it is meant for: when there is no pending message, the table is unlocked before the new message is enqueued. With the row lock, the enqueue is protected too. - The code no longer needs to guess whether it runs from the tests ($ENV{_} =~ /prove/ or KOHA_TESTING). Note: koha-qa reports a pod_coverage failure on C4/Message.pm for subs that already had no POD (AUTOLOAD, DESTROY, _metadata, _to_address); the patch does not add any. Bug 37548 is a different race (between the digest and process_message_queue), not addressed here. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
