LP#1953057: improve reset-after-crash handling for Perl apps user/csharp/rel_3_2_2_pines
authorGalen Charlton <gmc@equinoxOLI.org>
Thu, 2 Dec 2021 16:48:48 +0000 (11:48 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Tue, 18 Jan 2022 18:10:09 +0000 (13:10 -0500)
commitfbe021e2841b5d6b789800aff172d17c585b9137
treef21f078b6e7c45cb470508c26e100237bbd10660
parentbb7a3860acc2b52c3a3764768aae6e91a33fe6c1
LP#1953057: improve reset-after-crash handling for Perl apps

This patch more forcibly reaps children and resets the active
and idle lists after an uncaught exception in the main run
method triggers a reset of the service. This avoids an issue
where such a reset would result in the listener thinking it
has more running drones than is actually the case, which can
make it think it's hit max_children limits sooner than is actually
the case.

To test
-------
[1] Do something to arrange for a busy Perl service to throw
    an exception in the listener, such as setting up a replication
    of bug 1953044 or adding code to cause the listener to randomly
    throw an exception.
[2] Observe that the listener does not fully clean up the drones
    it has at the point of the crash, and consequently may think
    post-reset that it is closer to the max_children limit than
    is actually the case. One symptom of this is requests getting
    added to the backlog queue unecessarily.
[3] Apply the patch and repeat step 1. This time, the service should
    reset itself properly and handle requests and drones post-reset
    as expected.

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
src/perl/lib/OpenSRF/Server.pm