Bug 41707

Summary: The DIE handler in C4::SIP::Trapper is logging non-SIP errors, causing log flooding.
Product: Koha Reporter: Johanna Räisä <johanna.raisa>
Component: SIP2Assignee: Johanna Räisä <johanna.raisa>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: cornelius.hertfelder, dcook
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 41707: Modify C4::SIP::Trapper DIE handling for better logging

Description Johanna Räisä 2026-01-26 09:05:52 UTC
The DIE handler should be more restrictive and only log errors where the call stack clearly originates from SIP modules (e.g., C4::SIP::*). The current implementation is not strict enough or may have edge cases. Found this kind of errors from our logs:

[2026/01/23 13:42:47] [493898] [ERROR] [undef]@[undef]: commandline was not set during initialization at /usr/share/perl5/Net/Server.pm line 100.
 C4::SIP::Trapper::__ANON__ /home/koha/Koha/C4/SIP/Trapper.pm (70)
Comment 1 Johanna Räisä 2026-01-27 11:50:13 UTC
Created attachment 192093 [details] [review]
Bug 41707: Modify C4::SIP::Trapper DIE handling for better logging

This patch improves the error handling in the SIP Trapper module by
logging only SIP-related errors as errors and non-SIP errors as warnings. This
change aims to reduce noise in the logs and make it easier to identify
genuine SIP-related issues.

Test plan:
1. Apply the patch
2. prove -lv t/db_dependent/SIP/Trapper.t
3. Ensure all tests pass without errors
4. Start the server: perl C4/SIP/SIPServer.pm /etc/koha/SIPconfig.xml
5. misc/sip_cli_emulator.pl -a 127.0.0.1 -p 6001 -su koha -sp koha -l MPL --patron koha -m patron_information
6. Verify that only SIP-related errors are logged as errors and non-SIP errors are warned.

Sponsored-by: Koha-Suomi Oy