git: 50f554a5475f - stable/14 - rc.subr: Move the sleep in wait_for_pids
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Oct 2025 08:20:54 UTC
The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=50f554a5475fa274d7b832e2f7fa5add0218f222 commit 50f554a5475fa274d7b832e2f7fa5add0218f222 Author: Dag-Erling Smørgrav <des@FreeBSD.org> AuthorDate: 2025-09-23 12:55:56 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2025-10-02 07:28:57 +0000 rc.subr: Move the sleep in wait_for_pids Instead of sleeping while constructing the list of PIDs to wait for, sleep briefly after pwait to give init a chance to reap the processes that just terminated before we loop around and start probing them. PR: 289630 Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D52619 (cherry picked from commit 5953e7c98427e038500221e885dffa181dcc064b) --- libexec/rc/rc.subr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr index 5423af476ad0..a4f3762afd2c 100644 --- a/libexec/rc/rc.subr +++ b/libexec/rc/rc.subr @@ -646,7 +646,6 @@ wait_for_pids() for _j in $_list; do if kill -0 $_j 2>/dev/null; then _nlist="${_nlist}${_nlist:+ }$_j" - [ -n "$_prefix" ] && sleep 1 fi done if [ -z "$_nlist" ]; then @@ -656,6 +655,10 @@ wait_for_pids() echo -n ${_prefix:-"Waiting for PIDS: "}$_list _prefix=", " pwait -o $_list 2>/dev/null + # At least one of the processes we were waiting for + # has terminated. Give init a chance to collect it + # before looping around and checking again. + sleep 1 done if [ -n "$_prefix" ]; then echo "."