Bugzilla – Attachment 166970 Details for
Bug 36901
Add logging for uncaught exceptions in background job classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36901: Add logging for uncaught exceptions in background job classes
Bug-36901-Add-logging-for-uncaught-exceptions-in-b.patch (text/plain), 1.85 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-05-21 13:14:06 UTC
(
hide
)
Description:
Bug 36901: Add logging for uncaught exceptions in background job classes
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-05-21 13:14:06 UTC
Size:
1.85 KB
patch
obsolete
>From 0f531a4cbe1f08b5378034498187d39b018a35f9 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 21 May 2024 10:04:17 -0300 >Subject: [PATCH] Bug 36901: Add logging for uncaught exceptions in background > job classes > >This patch adds logging of unhandled exceptions that could occur. This >is happening on busy production sites right now. This is also useful for >plugin jobs that might not be 100% following the guidelines and would >benefit from this. > >But as the [DO NOT PUSH] patch highlights, this is something we really >want to have on our current codebase, as a database connection drop >might make us reach that `catch` block we are adding logging to on this >patch. > >To test: >1. Apply the [DO NOT PUSH] patch >2. Run: > $ ktd --shell > k$ restart_all ; tail -f /var/log/koha/kohadev/worker*.log >3. Pick a valid barcode on the staff UI >4. Use the 'Batch delete items' tool in the cataloguing section >5. Start the job for deleting the item >=> FAIL: The item got deleted, but the job marked as failed and no logs >about the reasons >6. Apply this patch and repeat 2-5 >=> SUCCESS: Same scenario but there's a log with the error message >7. Sign off :-D >--- > misc/workers/background_jobs_worker.pl | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/misc/workers/background_jobs_worker.pl b/misc/workers/background_jobs_worker.pl >index bfe126f0992..e2472d0fcdb 100755 >--- a/misc/workers/background_jobs_worker.pl >+++ b/misc/workers/background_jobs_worker.pl >@@ -202,8 +202,10 @@ $pm->wait_all_children; > sub process_job { > my ( $job, $args ) = @_; > try { >- $job->process( $args ); >+ $job->process($args); > } catch { >+ Koha::Logger->get( { interface => 'worker' } ) >+ ->warn( sprintf "Uncaught exception processing job id=%s: %s", $job->id, $_ ); > $job->status('failed')->store; > }; > } >-- >2.45.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36901
:
166969
|
166970
|
166992
|
166993
|
168245