From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 495AD1FF18C for <inbox@lore.proxmox.com>; Mon, 24 Mar 2025 14:31:01 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2E2DD1C3C5; Mon, 24 Mar 2025 14:30:56 +0100 (CET) Date: Mon, 24 Mar 2025 14:30:52 +0100 Message-Id: <D8OJ7LAIFO58.1ZUS67F0MQHBR@proxmox.com> From: "Christoph Heiss" <c.heiss@proxmox.com> To: "Wolfgang Bumiller" <w.bumiller@proxmox.com> Mime-Version: 1.0 X-Mailer: aerc 0.20.1 References: <20250317141152.1247324-1-c.heiss@proxmox.com> <20250317141152.1247324-5-c.heiss@proxmox.com> <hwjlbstxqqtzlcn6oq3vp6gctnv2xfubmif36chwnsbl4c3lf7@jg6ewf5iwxfc> In-Reply-To: <hwjlbstxqqtzlcn6oq3vp6gctnv2xfubmif36chwnsbl4c3lf7@jg6ewf5iwxfc> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH common 04/14] tools: add run_fork_detached() for spawning daemons X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Cc: pve-devel@lists.proxmox.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> 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