LP#1953047: don't try to kill children with non-numeric PIDs user/gmcharlt/lp1953047_only_kill_numeric_pids
authorGalen Charlton <gmc@equinoxOLI.org>
Thu, 2 Dec 2021 15:14:29 +0000 (10:14 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Thu, 2 Dec 2021 15:24:17 +0000 (10:24 -0500)
commit9d728db70a984803fc7e2b4d52e6a399f240c515
tree634c7bc42765ab99fa7f44902af6f1b9418e6a59
parent04524df6e341c47dd9ddd6e617b5d66f313b6b01
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