public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] PVE child process behavior question
@ 2025-05-21 13:13 Denis Kanchev via pve-devel
  2025-05-22  6:30 ` Fabian Grünbichler
  0 siblings, 1 reply; 15+ messages in thread
From: Denis Kanchev via pve-devel @ 2025-05-21 13:13 UTC (permalink / raw)
  To: pve-devel; +Cc: Denis Kanchev

[-- Attachment #1: Type: message/rfc822, Size: 6622 bytes --]

From: Denis Kanchev <denis.kanchev@storpool.com>
To: pve-devel@lists.proxmox.com
Subject: PVE child process behavior question
Date: Wed, 21 May 2025 16:13:01 +0300
Message-ID: <8a172f9c-3927-4bff-a2c8-01184098e506@storpool.com>

Hello,

We had an issue with a customer migrating a VM between nodes using our 
shared storage solution.

On the target host the OOM killer killed the main migration process, but 
the child process (which actually performs the migration) kept on 
working, which we did not expect, and that caused some issues.

This leads us to the broader question - after a request is submitted, 
the parent can be terminated, and not return a response to the client, 
while the work is being done, and the request can be wrongly retried or 
considered unfinished.

Should the child processes terminate together with the parent to guard 
against this, or is this expected behavior?


Here is an example patch to do this:


diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm

index bfde7e6..744fffc 100644

--- a/src/PVE/RESTEnvironment.pm

+++ b/src/PVE/RESTEnvironment.pm

@@ -13,8 +13,9 @@ use Fcntl qw(:flock);

  use IO::File;

  use IO::Handle;

  use IO::Select;

-use POSIX qw(:sys_wait_h EINTR);

+use POSIX qw(:sys_wait_h EINTR SIGKILL);

  use AnyEvent;

+use Linux::Prctl qw(set_pdeathsig);


  use PVE::Exception qw(raise raise_perm_exc);

  use PVE::INotify;

@@ -549,6 +550,9 @@ sub fork_worker {

POSIX::setsid();

     }


+   # The signal that the calling process will get when its parent dies

+   set_pdeathsig(SIGKILL);

+

POSIX::close ($psync[0]);

POSIX::close ($ctrlfd[0]) if $sync;

POSIX::close ($csync[1]);

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

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

end of thread, other threads:[~2025-06-04 12:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-21 13:13 [pve-devel] PVE child process behavior question Denis Kanchev via pve-devel
2025-05-22  6:30 ` Fabian Grünbichler
2025-05-22  6:55   ` Denis Kanchev via pve-devel
     [not found]   ` <857cbd6c-6866-417d-a71f-f5b5297bf09c@storpool.com>
2025-05-22  8:22     ` Fabian Grünbichler
2025-05-28  6:13       ` Denis Kanchev via pve-devel
     [not found]       ` <CAHXTzuk7tYRJV_j=88RWc3R3C7AkiEdFUXi88m5qwnDeYDEC+A@mail.gmail.com>
2025-05-28  6:33         ` Fabian Grünbichler
2025-05-29  7:33           ` Denis Kanchev via pve-devel
     [not found]           ` <CAHXTzumXeyJQQCj+45Hmy5qdU+BTFBYbHVgPy0u3VS-qS=_bDQ@mail.gmail.com>
2025-06-02  7:37             ` Fabian Grünbichler
2025-06-02  8:35               ` Denis Kanchev via pve-devel
     [not found]               ` <CAHXTzukAMG9050Ynn-KRSqhCz2Y0m6vnAQ7FEkCmEdQT3HapfQ@mail.gmail.com>
2025-06-02  8:49                 ` Fabian Grünbichler
2025-06-02  9:18                   ` Denis Kanchev via pve-devel
     [not found]                   ` <CAHXTzu=AiNx0iTWFEUU2kdzx9-RopwLc7rqGui6f0Q=+Hy52=w@mail.gmail.com>
2025-06-02 11:42                     ` Fabian Grünbichler
2025-06-02 13:23                       ` Denis Kanchev via pve-devel
     [not found]                       ` <CAHXTzu=qrZe2eEZro7qteR=fDjJQX13syfB9fs5VfFbG7Vy6vQ@mail.gmail.com>
2025-06-02 14:31                         ` Fabian Grünbichler
2025-06-04 12:52                           ` Denis Kanchev via pve-devel

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