Bug 290357 - rc.subr: changed sleep leads to very long shutdown times
Summary: rc.subr: changed sleep leads to very long shutdown times
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 14.3-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: Dag-Erling Smørgrav
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-10-19 08:07 UTC by Martin Birgmeier
Modified: 2025-10-30 23:53 UTC (History)
2 users (show)

See Also:
des: mfc-stable15+
des: mfc-stable14+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Birgmeier 2025-10-19 08:07:27 UTC
Scenario:
- FreeBSD stable/14 at b339da5b23e8 plus minor local patches
- Shutting down the system

Result:
- For every process, the shutdown script waits one second before proceeding to the next one. This results in very long shutdown times for systems with many running functions from /etc/rc.d and /usr/local/etc/rc.d.

Note:
- This was introduced in 5953e7c98427 and propagated to all branches.
- I am currently running with .2 seconds in /etc/rc.subr. I assume that much lower values would also work well, especially on modern machines.

-- Martin
Comment 1 Martin Birgmeier 2025-10-19 08:25:40 UTC
I have just changed it to .1 s. This also works well.

-- Martin
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2025-10-19 15:05:39 UTC
^Triage: Cc: to original committer.
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-10-28 11:57:54 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=22cff1f3e9d82b48aad440c52f883bfd4995359c

commit 22cff1f3e9d82b48aad440c52f883bfd4995359c
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-10-28 11:57:03 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-10-28 11:57:16 +0000

    rc.subr: Fix slow shutdown issue

    Instead of sleeping after pwait returns, use its new -p option to
    obtain the list of processes that still have not terminated.

    MFC after:      3 days
    PR:             290357
    Fixes:          5953e7c98427 ("rc.subr: Move the sleep in wait_for_pids")
    Reviewed by:    0mp, markj
    Differential Revision:  https://reviews.freebsd.org/D53294

 libexec/rc/rc.subr | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-10-30 10:38:48 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=7b375832c252430243810ca85d6cbf67820457d5

commit 7b375832c252430243810ca85d6cbf67820457d5
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-10-28 11:57:03 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-10-30 10:37:35 +0000

    rc.subr: Fix slow shutdown issue

    Instead of sleeping after pwait returns, use its new -p option to
    obtain the list of processes that still have not terminated.

    MFC after:      3 days
    PR:             290357
    Fixes:          5953e7c98427 ("rc.subr: Move the sleep in wait_for_pids")
    Reviewed by:    0mp, markj
    Differential Revision:  https://reviews.freebsd.org/D53294

    (cherry picked from commit 22cff1f3e9d82b48aad440c52f883bfd4995359c)

 libexec/rc/rc.subr | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-10-30 10:39:50 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=af13a06ab206b7009f689bf082ecbc776887ecee

commit af13a06ab206b7009f689bf082ecbc776887ecee
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-10-28 11:57:03 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-10-30 10:38:19 +0000

    rc.subr: Fix slow shutdown issue

    Instead of sleeping after pwait returns, use its new -p option to
    obtain the list of processes that still have not terminated.

    MFC after:      3 days
    PR:             290357
    Fixes:          5953e7c98427 ("rc.subr: Move the sleep in wait_for_pids")
    Reviewed by:    0mp, markj
    Differential Revision:  https://reviews.freebsd.org/D53294

    (cherry picked from commit 22cff1f3e9d82b48aad440c52f883bfd4995359c)

 libexec/rc/rc.subr | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-10-30 23:53:35 UTC
A commit in branch releng/15.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ac84e695eb4ecdd24185649abfd0b692c303d74e

commit ac84e695eb4ecdd24185649abfd0b692c303d74e
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-10-28 11:57:03 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-30 23:48:19 +0000

    rc.subr: Fix slow shutdown issue

    Instead of sleeping after pwait returns, use its new -p option to
    obtain the list of processes that still have not terminated.

    Approved by:    re (cperciva)
    MFC after:      3 days
    PR:             290357
    Fixes:          5953e7c98427 ("rc.subr: Move the sleep in wait_for_pids")
    Reviewed by:    0mp, markj
    Differential Revision:  https://reviews.freebsd.org/D53294

    (cherry picked from commit 22cff1f3e9d82b48aad440c52f883bfd4995359c)
    (cherry picked from commit 7b375832c252430243810ca85d6cbf67820457d5)

 libexec/rc/rc.subr | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)