[Bug 25493] New: Unhandled exceptions cause an exception
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Bug ID: 25493 Summary: Unhandled exceptions cause an exception Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com We rushed into using Koha::Logger as a Mojo::Log implementation, but there are some differences that need to be addressed before that can actually happen. This is not *that* problematic for production sites, but some things like hitting an undefined route will raise weird errors we need to avoid: GET http://kohadev.myDNSname.org:8081/api/v1/hola The application raised the following error: Can't use an undefined value as an ARRAY reference at template mojo/debug.html.ep line 311. 306: %= $kv->(Time => scalar localtime(time)) 307: </table> 308: </div> 309: <div class="tap">tap for more</div> 310: </div> 311: % if (@{app->log->history}) { 312: <div id="log" class="box infobox spaced"> 313: <table> 314: % for my $msg (@{app->log->history}) { 315: <tr> 316: <td class="striped value wide"> and the StackTrace middleware couldn't catch its stack trace, possibly because your application overrides $SIG{__DIE__} by itself, preventing the middleware from working correctly. Remove the offending code or module that does it: known examples are CGI::Carp and Carp::Always. <<<<< We need to move back to using plain Koha::Logger, and rethink the proposal from bug 18205 to use MojoX::Log::Log4perl. That certainly belongs to another bug. -- 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=25493 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Unhandled exceptions cause |Koha::Logger is not |an exception |suitable for using as | |Mojo::Log -- 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=25493 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- 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=25493 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 104852 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=104852&action=edit Bug 25493: Make ->unhandled_exception use Koha::Logger To test: 1. Edit the Koha/REST/V1/Cities.pm 'list' method adding die("Nada"); before the render step. 2. Restart plack and try the endpoint => SUCCESS: The message is generic, but you see something is logged in /var/log/koha/kohadev/api-error.log 3. Change die("Nada"); for a real exception like: use Koha::Exceptions; Koha::Exceptions::DuplicateObject->throw("Nada"); 4. Repeat 2. => SUCCESS: The message is generic, but a meaningful text is added to the logs. 5. Point your browser to the /api/v1/hola route from your dev environment => FAIL: Wow, such a weird error 6. Apply this patch 7. Restart plack and repeat 2, 3 and 4 => SUCCESS: No behaviour change 8. Repeat 5 => SUCCESS: The regular Mojolicious 404 weird page 9. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |25032 Keywords| |rel_20_05_candidate Severity|major |normal Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25032 [Bug 25032] Generic unhandled exception handling -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |jonathan.druart@bugs.koha-c | |ommunity.org CC| |jonathan.druart@bugs.koha-c | |ommunity.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joonas.kylmala@helsinki.fi, | |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=25493 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Kyle M Hall <kyle@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=25493 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #104852|0 |1 is obsolete| | --- Comment #2 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 105016 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105016&action=edit Bug 25493: Make ->unhandled_exception use Koha::Logger To test: 1. Edit the Koha/REST/V1/Cities.pm 'list' method adding die("Nada"); before the render step. 2. Restart plack and try the endpoint => SUCCESS: The message is generic, but you see something is logged in /var/log/koha/kohadev/api-error.log 3. Change die("Nada"); for a real exception like: use Koha::Exceptions; Koha::Exceptions::DuplicateObject->throw("Nada"); 4. Repeat 2. => SUCCESS: The message is generic, but a meaningful text is added to the logs. 5. Point your browser to the /api/v1/hola route from your dev environment => FAIL: Wow, such a weird error 6. Apply this patch 7. Restart plack and repeat 2, 3 and 4 => SUCCESS: No behaviour change 8. Repeat 5 => SUCCESS: The regular Mojolicious 404 weird page 9. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105016|0 |1 is obsolete| | --- Comment #3 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 105100 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105100&action=edit Bug 25493: Make ->unhandled_exception use Koha::Logger To test: 1. Edit the Koha/REST/V1/Cities.pm 'list' method adding die("Nada"); before the render step. 2. Restart plack and try the endpoint => SUCCESS: The message is generic, but you see something is logged in /var/log/koha/kohadev/api-error.log 3. Change die("Nada"); for a real exception like: use Koha::Exceptions; Koha::Exceptions::DuplicateObject->throw("Nada"); 4. Repeat 2. => SUCCESS: The message is generic, but a meaningful text is added to the logs. 5. Point your browser to the /api/v1/hola route from your dev environment => FAIL: Wow, such a weird error 6. Apply this patch 7. Restart plack and repeat 2, 3 and 4 => SUCCESS: No behaviour change 8. Repeat 5 => SUCCESS: The regular Mojolicious 404 weird page 9. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |martin.renvoize@ptfs-europe | |.com --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- A simple pragmatic approach to resolving the bug before release, thanks guys Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.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=25493 --- Comment #5 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_20_05_candidate | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25493 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joy@bywatersolutions.com --- Comment #6 from Joy Nelson <joy@bywatersolutions.com> --- missing dependencies-not backported to 19.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org