Date: Sun, 15 Feb 2026 03:15:41 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 293183] pwait returns before process actually terminates Message-ID: <bug-293183-227-KOlfgyU1vs@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-293183-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293183 --- Comment #2 from Cullum Smith <cullum@sacredheartsc.com> --- Running pwait with -v, I see : # kill $pid; pwait -v $pid; ps -p $pid 34424: exited with status 0. PID TT STAT TIME COMMAND 34424 - REJ 0:07.05 /usr/local/invidious/invidious.git/invidious So, pwait's behavior is not necessarily wrong. The process has terminated with an exit code and has just yet to be fully cleaned up from the process table. Still, there is a problem because: 1. The default behavior of `/etc/rc.d/foo restart` simply does: /etc/rc.d/foo stop /etc/rc.d/foo start 2. And the default behavior of `/etc/rc.d/foo stop` is to call wait_for_pids shell function, which in turn calls pwait on the PID stored in $pidfile. 3. And the default behavior of `/etc/rc.d/foo start` is to call the check_pidfile shell function, which ensures that the PID referred to in the $pidfile does not refer to the daemon's $procname. 4. So, what happens is that after step #2 calls pwait, there is still an entry for the defunct daemon in the process list. So check_pidfile in step #3 ends up matching on this entry, causing the daemon to refuse to start because the daemon appears to be already running. I don't recall having this issue in the past. It's possible FreeBSD 15 introduced some change that causes the dead process to hang around in the process table for a longer period of time? In any case, this is probably a bug in the rc.subr system, rather than pwait. The default `restart` behavior is unreliable due to this race condition. -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-293183-227-KOlfgyU1vs>
