https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41678

--- Comment #4 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 203202
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=203202&action=edit
Bug 41678: Add warning log when SIPServer reaches max_servers capacity

This enhancement adds logging to warn administrators when the SIP server
reaches its configured maximum number of child processes. The warning is
logged periodically (once per second) when the current child count equals
or exceeds the max_servers configuration value.

The check is implemented in idle_loop_hook, which Net::Server::PreFork
calls repeatedly, in the parent process, for the life of the server, once
child processes exist. pre_loop_hook was considered first but doesn't
work for this: it is called exactly once, before the accept loop starts
and before any child has been forked, so it can never observe a nonzero
child count.

idle_loop_hook only ever runs in the parent/arbiter process, never in the
child processes that handle SIP protocol traffic, so this adds no
overhead to the per-transaction hot path. The check itself is throttled
to once per second, and Net::Server::PreFork already performs comparable
or heavier accounting (time() calls, full scans of the children hash,
child liveness probes) on every pass of the same parent loop.

Test plan:
1) Apply the patch and confirm it compiles and lints cleanly:
     perl -c C4/SIP/SIPServer.pm
     perl misc/devel/tidy.pl C4/SIP/SIPServer.pm
   Both should report no issues / no changes needed.

2) Run the unit tests:
     prove t/db_dependent/SIP/SIPServer.t
   All subtests should pass, including the new idle_loop_hook tests.

3) Functional test:
   - Set max_servers to a small value (e.g. 2) in the SIP2 config for a
     test instance.
   - Start the SIP server and open enough concurrent SIP2 connections
     (e.g. via telnet/nc to the configured port) to reach that count.
   - Tail the SIP log (the 'sip' log4perl category, e.g.
     /var/log/koha/<instance>/sip-error.log) and confirm a WARNING line
     appears:
       "SIPServer at maximum capacity: 2/2 child processes running"
   - Confirm it logs at most once per second while at capacity, and
     stops once a connection closes and the child count drops below
     max_servers.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to