LP#1953047: don't try to kill children with non-numeric PIDs
authorGalen Charlton <gmc@equinoxOLI.org>
Thu, 2 Dec 2021 15:14:29 +0000 (10:14 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Tue, 18 Jan 2022 18:09:50 +0000 (13:09 -0500)
commitbb7a3860acc2b52c3a3764768aae6e91a33fe6c1
tree6e5c89ded0f5e24101e583065404bc8b5cb3a883
parentbc3beabdcdd42122346ce97f0ea0834d08e2b1bb
LP#1953047: don't try to kill children with non-numeric PIDs

This patch band-aids around the following listener error that
we've occassionally seen:

  server: died with error Can't kill a non-numeric process ID
  at .../OpenSRF/Server.pm line 335.

With this patch, OpenSRF::Server->kill_child() will now simply
log a warning rather than passing a non-numeric value to kill()

This patch does not address the root cause, which is still unknown,
but could include:

- An actual failure to fork a new child leading to an undef PID
  ending up on the drone list. As OpenSRF::Server does
  not currently check for undef return from fork(), this cannot
  be dismissed, but this doesn't fit our observations.
- Something akin to bug 1953044; in particular, there might be
  a race condition between ->reap_children(), ->check_status(),
  and ->handle_sighup() that results in an attempt to kill a
  child that's already been reaped. If so, the patch for bug
  1953044 *might* also ameliorate this crash.

To test
-------
[1] Check logs to see if you've encountered the issue listed above.
[2] Apply the patch and wait to see if the error ever recurs or
    if you see one of the two warnings in the log:

    refused to kill child with non-numeric PID $pid
    refused to kill child with undefined PID

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