Koha-clms/C4/SIP
Kyle M Hall f899761666
Bug 42664: Reload SIP2 configuration in every worker process
SIP2 accounts/institutions are stored in the database and the SIP server is supposed to reload its configuration when they change.

In practice, after adding or editing a SIP2 account, most SIP worker processes keep serving the old configuration (e.g. new accounts get "SIP access not authorized") until the SIP server is restarted ( I tested multiple times over 30 minutes ).

There seem to be two issues:
* L1 cache flushed too late. process_request() calls _config_up_to_date() before Koha::Caches->flush_L1_caches(). The SIP parent reads sip2_resource_last_modified into its own L1 cache at startup and never flushes it. Every worker inherits that stale L1, so a worker's first connection compares against the startup-era value instead of the current shared value.

* sip2_config_read_timestamp is stored in the shared (memcached) cache, but the configuration it tracks is per-process. When one worker reloads the config from the database, it bumps the shared timestamp, so every other worker then evaluates as "up to date" and never reloads its own stale in-memory config.

Test Plan:
1) Configure the SIP server with several worker processes (e.g. set
   min_servers and max_servers to 5) and confirm an existing SIP2
   account works
2) Add a new SIP2 account in the staff interface
3) Without restarting the SIP server, test the new account with misc/sip_cli_emulator.pl
4) Note the login fails
5) Apply this patch
6) Restart all the things!
7) Add another new SIP2 account
8) Without restarting the SIP server test this new account with sip_cli_emulator.pl
9) Note that the new account works!
10) prove t/db_dependent/SIP/SIPServer.t

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-06-29 15:38:47 +00:00
..
ILS Bug 23909: Extend SIP to distinguish pending vs waiting holds 2026-05-01 11:04:19 -06:00
Sip Bug 42664: Reload SIP2 configuration in every worker process 2026-06-29 15:38:47 +00:00
ILS.pm Bug 41369: SIP payments have no branchcode 2025-12-17 13:24:30 -07:00
Logger.pm Bug 40680: Move EXPORT_OK right after Modern::Perl 2025-12-01 08:33:56 -07:00
Makefile
…
README
…
SIPServer.pm Bug 42664: Reload SIP2 configuration in every worker process 2026-06-29 15:38:47 +00:00
Sip.pm Bug 40675: Fix SIP message corruption from embedded line endings 2025-09-19 08:42:47 -06:00
Trapper.pm Bug 39911: Remove redundant warn 2025-06-13 13:09:41 -06:00

README

README for Open NSIP 3M-SIP Server

DEPENDENCIES

SIPServer is written entirely in Perl, but it require these CPAN
perl modules to run:

     Net::Server - The SIP server is a Net::Server::Prefork server
     XML::LibXML
     XML::Parser
     XML::Simple - for parsing the config file
     UNIVERSAL::require - for loading the correct ILS interface module
     Clone - for running the test cases

LOGGING

SIPServer uses Koha::Logger for status and debugging messages.