From ae22fd1f9f486ec146248345e64616f1f1be35b1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 5 Jun 2023 10:34:46 -0400 Subject: [PATCH] Bug 33898: background_jobs_worker.pl may leave defunct children processes for extended periods of time It appears that the background jobs worker can leave defunct processes for periods of time. Though it is mostly harmless, it would be nice if that did not happen. Children are reaped automatically when start or wait_all_children are called. We only call start when a new job is found, and wait_all_children after exiting our while loop. The solution is to simply call reap_all_children after we sleep. This is a non-blocking call that will clean up those defunct processes. Test Plan: 1) Disable Rabbit 2) Set background_jobs_worker/max_processes to something like 5 3) Restart all the things! 4) Run a bunch of elastic index updates 5) Verify you have defunct processes 6) Apply this patch 7) Run more elastic index updates 8) Defunct processes should disappear every 10 seconds or so! If you do not see defunct processes, the test plan is to simply verify everything continues to work as expected. --- misc/workers/background_jobs_worker.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/misc/workers/background_jobs_worker.pl b/misc/workers/background_jobs_worker.pl index c54610458f..65ec0a2ab9 100755 --- a/misc/workers/background_jobs_worker.pl +++ b/misc/workers/background_jobs_worker.pl @@ -157,6 +157,7 @@ while (1) { } sleep 10; + $pm->reap_finished_children(); } } $conn->disconnect; -- 2.30.2