On Tue Mar 18, 2025 at 11:28 AM CET, Wolfgang Bumiller wrote: > On Mon, Mar 17, 2025 at 03:11:41PM +0100, Christoph Heiss wrote: >> This essentially just does a fork() + setsid(). >> Needed to e.g. properly spawn background processes. >> >> Signed-off-by: Christoph Heiss <c.he...@proxmox.com> >> --- >> Something similar is already used in e.g. pve-storage to spawn fuse >> mounts. If and when this is applied, I'd migrate these sites to this sub >> too. > > IIRC there are still outstanding issues with it creating zombie > processes because it only does a single fork instead of properly > daemonizing with a double-fork.
Good to know, thanks! I'd be open to fixing/implementing this properly, along with this series. The "simple" fix here though would probably be to fork+exec in perl (like this patch already does) and additionally implement a `--daemonize` flag on the "other" side, which forks again inside the exec'd executable? > > While an alternative to double-forking would be to see if we can add a > general child-reaping mechanic to our daemons (either via a proper > SIGCLD handler, or a signalfd if AnyEvent supports that?), it is > situation dependent on whether the process should be a child process or > a "detached" process as the sub below implies Yeah, in the context of this series the daemon should not be a child process, at least not of pvedaemon. Its usefulness/lifetime is basically tied to that of the associated VM, much like e.g. swtpm. > - the question there being whether the child should be killed if the > parent dies. _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel