[Bug 33649] New: Fix use of cronlogaction in process_message_queue.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Bug ID: 33649 Summary: Fix use of cronlogaction in process_message_queue.pl 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: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org process_message_queue.pl has this code: try { $script_handler->lock_exec; } catch { my $message = "Skipping execution of $0 ($_)"; print STDERR "$message\n" if $verbose; cronlogaction( $message ); exit; }; If lock_exec fails for some reason, we get this error: $ sudo koha-foreach --chdir --enabled --email /usr/share/koha/bin/cronjobs/process_message_queue.pl Can't use string ("Skipping execution of /usr/share"...) as a HASH ref while "strict refs" in use at /usr/share/koha/lib/C4/Log.pm line 135. mykoha: 13 status returned by "/usr/share/koha/bin/cronjobs/process_message_queue.pl" This is because cronlogaction should be called like this: cronlogaction({ info => $message }) -- 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=33649 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |magnus@libriotech.no |ity.org | -- 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=33649 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com --- Comment #1 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- There is an other one in misc/cronjobs/fines.pl. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |31203 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31203 [Bug 31203] Cronjobs should log completion as well as logging begin -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Fix use of cronlogaction in |Fix use of cronlogaction |process_message_queue.pl | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 --- Comment #2 from Magnus Enger <magnus@libriotech.no> --- (In reply to Jonathan Druart from comment #1)
There is an other one in misc/cronjobs/fines.pl.
Yeah, just spotted it. :-) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 --- Comment #3 from Magnus Enger <magnus@libriotech.no> --- Created attachment 150563 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150563&action=edit Bug 33649: Fix use of cronlogaction C4::Log::cronlogaction() takes a hashref as argument, with "info" and possibly "action" as keys. But there are a couple of places where it is called with just a string as argument, and that does not work. Both places need lock_exec to fail to trigger the error. I have seen this on a production server, but not been able to reproduce in ktd. To test: - Run this on the Koha repo: grep -r "cronlogaction(" * - Verify that fines.pl and process_message_queue.pl are the only scripts that call cronlogaction without a hashref as argument, but do it like this: cronlogaction( $message ); - Apply this patch - Run the grep again and verify that all calls to cronlogaction now take a hashref as argument -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #150563|0 |1 is obsolete| | --- Comment #4 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 150573 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150573&action=edit Bug 33649: Fix use of cronlogaction C4::Log::cronlogaction() takes a hashref as argument, with "info" and possibly "action" as keys. But there are a couple of places where it is called with just a string as argument, and that does not work. Both places need lock_exec to fail to trigger the error. I have seen this on a production server, but not been able to reproduce in ktd. To test: - Run this on the Koha repo: grep -r "cronlogaction(" * - Verify that fines.pl and process_message_queue.pl are the only scripts that call cronlogaction without a hashref as argument, but do it like this: cronlogaction( $message ); - Apply this patch - Run the grep again and verify that all calls to cronlogaction now take a hashref as argument 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=33649 Jonathan Druart <jonathan.druart+koha@gmail.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=33649 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #150573|0 |1 is obsolete| | --- Comment #5 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 150577 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150577&action=edit Bug 33649: Fix use of cronlogaction C4::Log::cronlogaction() takes a hashref as argument, with "info" and possibly "action" as keys. But there are a couple of places where it is called with just a string as argument, and that does not work. Both places need lock_exec to fail to trigger the error. I have seen this on a production server, but not been able to reproduce in ktd. To test: - Run this on the Koha repo: grep -r "cronlogaction(" * - Verify that fines.pl and process_message_queue.pl are the only scripts that call cronlogaction without a hashref as argument, but do it like this: cronlogaction( $message ); - Apply this patch - Run the grep again and verify that all calls to cronlogaction now take a hashref as argument Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal --- Comment #6 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Can be tested easily adding a sleep right after the lock. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.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=33649 --- Comment #7 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=33649 Bug 33649 depends on bug 31203, which changed state. Bug 31203 Summary: Cronjobs should log completion as well as logging begin https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31203 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|23.05.00 |23.05.00,22.11.06 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33649 --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Many hands makes light work, thankyou 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=33649 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |lucas@bywatersolutions.com Status|Pushed to stable |RESOLVED --- Comment #9 from Lucas Gass <lucas@bywatersolutions.com> --- Missing dependencies for 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