LP1953044 Avoid ref to free'd array in Server child maintenance user/berick/lp1953044-loop-freed-value
authorBill Erickson <berickxx@gmail.com>
Mon, 25 Jul 2022 14:05:23 +0000 (10:05 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 25 Jul 2022 14:05:27 +0000 (10:05 -0400)
commit44c988b2c608855db5dd5000050b24476a73411e
tree9f7362629db75a6010845dbc22dd7efd04d32375
parent9fa5fbbd05d2ade6a6359c16ff6056561fbeca51
LP1953044 Avoid ref to free'd array in Server child maintenance

The Server active_list array is replaced / rebuilt during child process
maintenance.  Because of this, referencing the array ref can lead to the
below error if child process maintance occurs via signal mid-loop.

server: died with error Use of freed value in iteration
at /usr/lib/x86_64-linux-gnu/perl/5.28/IO/Select.pm line 70.

Avoid requiring array dereferencing on a potentially freed value by
creating a local array containing the original contents of idle_list.

Additionally, sanity check the child objects to verify they are not in
the middle of getting cleaned up.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
src/perl/lib/OpenSRF/Server.pm