Bug 25992

Summary: SIP2 server doesn't start - Undefined subroutine set_logger
Product: Koha Reporter: Joonas Kylmälä <joonas.kylmala>
Component: SIP2Assignee: Joonas Kylmälä <joonas.kylmala>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: critical    
Priority: P5 - low CC: aleisha, colin.campbell, jonathan.druart, kyle, lucas, martin.renvoize, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.03
Bug Depends on: 15253    
Bug Blocks:    
Attachments: Bug 25992: Make SIP2 logger subroutines exportable to prevent crash
Bug 25992: Make SIP2 logger subroutines exportable to prevent crash
Bug 25992: Make SIP2 logger subroutines exportable to prevent crash

Description Joonas Kylmälä 2020-07-15 11:08:07 UTC
After the SIP2 server refactoring in Bug 15253 the sip2 server doesn't start anymore because of this error:

> Undefined subroutine &C4::SIP::SIPServer::set_logger called at /kohadevbox/koha/C4/SIP/SIPServer.pm
Comment 1 Joonas Kylmälä 2020-07-15 11:39:36 UTC
Created attachment 106928 [details] [review]
Bug 25992: Make SIP2 logger subroutines exportable to prevent crash

If the subroutines are not exportable we get the following crash:

> Undefined subroutine &C4::SIP::SIPServer::set_logger

To test:
 In kohadevbox run for example:
 $ ps -aux # check that no existing sip server is running, kill the process if exists
 $ perl /kohadevbox/koha/C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml
 $ koha/misc/sip_cli_emulator.pl -su koha -sp koha -l CPL -a 127.0.0.1 -p 6001 --item 3999900000001 -m item_information

 After applying this patch the Undefined subroutine error should be gone.
 Note: when using the sip_cli_emulator.pl the credentials can be anything.
Comment 2 Nick Clemens 2020-07-15 11:57:29 UTC
Created attachment 106929 [details] [review]
Bug 25992: Make SIP2 logger subroutines exportable to prevent crash

If the subroutines are not exportable we get the following crash:

> Undefined subroutine &C4::SIP::SIPServer::set_logger

To test:
 In kohadevbox run for example:
 $ ps -aux # check that no existing sip server is running, kill the process if exists
 $ perl /kohadevbox/koha/C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml
 $ koha/misc/sip_cli_emulator.pl -su koha -sp koha -l CPL -a 127.0.0.1 -p 6001 --item 3999900000001 -m item_information

 After applying this patch the Undefined subroutine error should be gone.
 Note: when using the sip_cli_emulator.pl the credentials can be anything.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 3 Tomás Cohen Arazi 2020-07-15 12:46:52 UTC
Created attachment 106933 [details] [review]
Bug 25992: Make SIP2 logger subroutines exportable to prevent crash

If the subroutines are not exportable we get the following crash:

> Undefined subroutine &C4::SIP::SIPServer::set_logger

To test:
 In kohadevbox run for example:
 $ ps -aux # check that no existing sip server is running, kill the process if exists
 $ perl /kohadevbox/koha/C4/SIP/SIPServer.pm /etc/koha/sites/kohadev/SIPconfig.xml
 $ koha/misc/sip_cli_emulator.pl -su koha -sp koha -l CPL -a 127.0.0.1 -p 6001 --item 3999900000001 -m item_information

 After applying this patch the Undefined subroutine error should be gone.
 Note: when using the sip_cli_emulator.pl the credentials can be anything.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Jonathan Druart 2020-07-15 15:01:47 UTC
We are missing a test here, it's not normal to get this situation on stable branches. It won't block the push but it's worth investigating what could be done to make sure we won't face it anymore.
Comment 5 Tomás Cohen Arazi 2020-07-15 15:03:39 UTC
I've been looking at the lack of tests issue. The only way I found to test this is by using the emulator.
I think we need to revisit SIP altogether to allow proper testing, but marked this one PQA for being a trivial fix.
Comment 6 Martin Renvoize 2020-07-16 14:41:23 UTC
Pushed to master for 20.11, thanks everyone.
Comment 7 Lucas Gass 2020-07-24 20:37:32 UTC
backported to 20.05.x for 20.05.03
Comment 8 Aleisha Amohia 2020-08-03 20:23:28 UTC
missing dependencies, not backported to 19.11.x