all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Christoph Heiss" <c.heiss@proxmox.com>
To: "Wolfgang Bumiller" <w.bumiller@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH common 04/14] tools: add run_fork_detached() for spawning daemons
Date: Mon, 24 Mar 2025 14:30:52 +0100	[thread overview]
Message-ID: <D8OJ7LAIFO58.1ZUS67F0MQHBR@proxmox.com> (raw)
In-Reply-To: <hwjlbstxqqtzlcn6oq3vp6gctnv2xfubmif36chwnsbl4c3lf7@jg6ewf5iwxfc>

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.heiss@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


  reply	other threads:[~2025-03-24 13:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 14:11 [pve-devel] [PATCH many 00/14] fix #5180: migrate conntrack state on live migration Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH proxmox-ve-rs 01/14] config: guest: allow access to raw Vmid value Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH proxmox-firewall 02/14] firewall: add connmark rule with VMID to all guest chains Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH pve-firewall 03/14] " Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH common 04/14] tools: add run_fork_detached() for spawning daemons Christoph Heiss
2025-03-18 10:28   ` Wolfgang Bumiller
2025-03-24 13:30     ` Christoph Heiss [this message]
2025-03-17 14:11 ` [pve-devel] [PATCH qemu-server 05/14] qmp helpers: allow passing structured args via qemu_objectadd() Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH qemu-server 06/14] api2: qemu: add module exposing node migration capabilities Christoph Heiss
2025-04-24 12:01   ` Fiona Ebner
2025-03-17 14:11 ` [pve-devel] [PATCH qemu-server 07/14] fix #5180: libexec: add QEMU dbus-vmstate daemon for migrating conntrack Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH qemu-server 08/14] fix #5180: migrate: integrate helper for live-migrating conntrack info Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH manager 09/14] api2: capabilities: explicitly import CPU capabilities module Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH manager 10/14] api2: capabilities: proxy index endpoints to respective nodes Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH manager 11/14] api2: capabilities: expose new qemu/migration endpoint Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [PATCH manager 12/14] ui: window: Migrate: add checkbox for migrating VM conntrack state Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [RFC PATCH firewall 13/14] firewall: helpers: add sub for flushing conntrack entries by mark Christoph Heiss
2025-03-17 14:11 ` [pve-devel] [RFC PATCH qemu-server 14/14] migrate: flush old VM conntrack entries after successful migration Christoph Heiss
2025-03-18  8:52 ` [pve-devel] [PATCH many 00/14] fix #5180: migrate conntrack state on live migration DERUMIER, Alexandre via pve-devel
2025-04-24 11:37 ` Christoph Heiss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D8OJ7LAIFO58.1ZUS67F0MQHBR@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=w.bumiller@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal