public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage] fix #6073: esxi: fix zombie process after storage removal
@ 2025-07-01 15:41 Stelios Vailakakis
  2025-08-04 18:38 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stelios Vailakakis @ 2025-07-01 15:41 UTC (permalink / raw)
  To: pve-devel

After removing an ESXi storage, a zombie process is generated because
the forked FUSE process (esxi-folder-fuse) is not properly reaped.

This patch implements a double-fork mechanism to ensure the FUSE process
is reparented to init (PID 1), which will properly reap it when it
exits. Additionally adds the missing waitpid() call to reap the
intermediate child process.

Tested on Proxmox VE 8.4.1 with ESXi 8.0U3e storage.

Signed-off-by: Stelios Vailakakis <stelios@libvirt.dev>
---
 src/PVE/Storage/ESXiPlugin.pm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm
index ab5242d..7c2d16a 100644
--- a/src/PVE/Storage/ESXiPlugin.pm
+++ b/src/PVE/Storage/ESXiPlugin.pm
@@ -211,7 +211,17 @@ sub esxi_mount : prototype($$$;$) {
     if (!$pid) {
         eval {
             undef $rd;
-            POSIX::setsid();
+            
+            # Double fork to properly daemonize
+            POSIX::setsid() or die "failed to create new session: $!\n";
+            my $pid2 = fork();
+            die "second fork failed: $!\n" if !defined($pid2);
+
+            if ($pid2) {
+                # First child exits immediately
+                POSIX::_exit(0);
+            }
+            # Second child (grandchild) enters systemd scope
             PVE::Systemd::enter_systemd_scope(
                 $scope_name_base,
                 "Proxmox VE FUSE mount for ESXi storage $storeid (server $host)",
@@ -243,6 +253,8 @@ sub esxi_mount : prototype($$$;$) {
         }
         POSIX::_exit(1);
     }
+    # Parent wait for first child to exit
+    waitpid($pid, 0);
     undef $wr;
 
     my $result = do { local $/ = undef; <$rd> };
-- 
2.39.5


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH storage] fix #6073: esxi: fix zombie process after storage removal
  2025-07-01 15:41 [pve-devel] [PATCH storage] fix #6073: esxi: fix zombie process after storage removal Stelios Vailakakis
@ 2025-08-04 18:38 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-08-04 18:38 UTC (permalink / raw)
  To: pve-devel, Stelios Vailakakis

On Tue, 01 Jul 2025 15:41:35 +0000, Stelios Vailakakis wrote:
> After removing an ESXi storage, a zombie process is generated because
> the forked FUSE process (esxi-folder-fuse) is not properly reaped.
> 
> This patch implements a double-fork mechanism to ensure the FUSE process
> is reparented to init (PID 1), which will properly reap it when it
> exits. Additionally adds the missing waitpid() call to reap the
> intermediate child process.
> 
> [...]

Applied, to master and the stable-8 branch, thanks!

[1/1] fix #6073: esxi: fix zombie process after storage removal
      commit: c33abdf0628fbb0901f1b332bf987c210b438c43


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-04 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-01 15:41 [pve-devel] [PATCH storage] fix #6073: esxi: fix zombie process after storage removal Stelios Vailakakis
2025-08-04 18:38 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal