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 DDEA61FF183 for <inbox@lore.proxmox.com>; Wed, 21 May 2025 15:13:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6CDCC190F0; Wed, 21 May 2025 15:13:11 +0200 (CEST) Date: Wed, 21 May 2025 16:13:01 +0300 To: pve-devel@lists.proxmox.com MIME-Version: 1.0 Message-ID: <mailman.538.1747833190.394.pve-devel@lists.proxmox.com> List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Post: <mailto:pve-devel@lists.proxmox.com> From: Denis Kanchev via pve-devel <pve-devel@lists.proxmox.com> Precedence: list Cc: Denis Kanchev <denis.kanchev@storpool.com> X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> 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/> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> Subject: [pve-devel] PVE child process behavior question Content-Type: multipart/mixed; boundary="===============4356554987158780151==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> This is a multi-part message in MIME format. --===============4356554987158780151== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: <denis.kanchev@storpool.com> X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id CDD06D025C for <pve-devel@lists.proxmox.com>; Wed, 21 May 2025 15:13:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AF7D819122 for <pve-devel@lists.proxmox.com>; Wed, 21 May 2025 15:13:10 +0200 (CEST) Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for <pve-devel@lists.proxmox.com>; Wed, 21 May 2025 15:13:09 +0200 (CEST) Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5efe8d9ebdfso12329713a12.3 for <pve-devel@lists.proxmox.com>; Wed, 21 May 2025 06:13:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=storpool.com; s=google; t=1747833183; x=1748437983; darn=lists.proxmox.com; h=subject:from:content-language:to:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=MqBqxfuDR171CZN4F4OISuFeWTsxWicWuCQdbAapYw0=; b=bt0Au+2490Z9IMSAWn5SPwpJQwR6e1/kdmvaQK9kcCo0mHWV/u4r/i81WiwBT70wWj WDuydUQerxZ3ZPBD6w76ldZbSITByycWipPS9ShDaxPCFYpqEAnWu2C/m95zFDEr8lxn GGLO+DZk8rb6r8Zt1Qi5BCSTL9BXzGr/GPlXU6AaIEMh7WEGnNu4kzU7d2JftYL+xjFd GimRuq0cfH8gz4yHe0J9c5FboYUaJv6Sr9QeFue5Lm0h9/ARDgG+oMRTi8GpV4zKWtXq yurLtTJ769f3SCoqVnMtlSHj039plhIyVnNNR4N6QVkbkal8P+2fbw3SpxoinP3InMkg Q6WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747833183; x=1748437983; h=subject:from:content-language:to:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MqBqxfuDR171CZN4F4OISuFeWTsxWicWuCQdbAapYw0=; b=OGPcz0Fpndg48MR1d7/Ck9z5Qz2EaoWCku2UJ0xpa0flVYLjRn9zjyEHA/Y/3k2OGX Mu2IH3tM8d4W2rUS8dw9FRWzwK5TK+bMdav9Zg4jSuK5xgHZOpwNJYGPx6cQ9hwJQ67+ gb73r06h4SIb/CpC7AGyv5dfpNbTSJweWqteBs6ic/5Zpj4pYumabCjTCpoQ1aHTwD+7 i0zEt4DDy0NRjtMKGMJ77bdQeuUTnnUha0Bm/lZQgxAssPbctXhhObXOc1tiE3fp/5Lx D+EHW3ZIGzFMW5pVP7aUWgut8rkfGEvLhpUqWJN+TQhgJxWiwb6N6T2cSaMOXAxD0mEA slxA== X-Gm-Message-State: AOJu0YxHMLs8cGRED33VzWlS2pI0m8jVGwBXrTBiVUgyqMy9JGgH+XL2 EffOTSre9I/7Nyt9VR8nOsXv3ykbedbkJ5+qy+jPYTGZt57A2wq41P/B4hacoqVRxJYACZhgNcZ LEZ5RdY4= X-Gm-Gg: ASbGnctL/k/qq+ybs4mSZNcbC4/URS3TkOLRXuV1UWBlp2pbnUknIZiVhWW+OysKVRe zT9lo5URdvrcymBZidR3tAyzoldeuq0nTcCps2K/yCzyomU7k+42cg8tk+1hfzTueUhjk7KJRcy Vws0D5yZm0VimF0Y+wl3JjI2wpN+oHwQsLyIFzmTudr9F/dov5ZSWb9Cg8l7wX4E1YMUM9FTDTw sbWZYnnFjWJC1MVzQTLwOI3JboeIfNRN96lqumCIQKfpIOHmtkB/bkqoYVgERNTltJCb1fRDzSY I5b8cUnIcjLzog5ztReMMSMLbbEIbmxfqnlrzmJszn7d23udbRhlhsUiDLSHhX4BUjoPoF4zBGu H27VIs9NE9BwcTO0hYHg= X-Google-Smtp-Source: AGHT+IHmVBHoPaiFwFuqjjPrs1T047Z7jun3RYziqQAteMhjb9vgBjr2gougOUsVe/8T3ZQ/53vAkQ== X-Received: by 2002:a17:907:970b:b0:ad5:2a24:7c09 with SMTP id a640c23a62f3a-ad537036d15mr1667009666b.60.1747833183037; Wed, 21 May 2025 06:13:03 -0700 (PDT) Received: from [192.168.0.165] (79-100-232-190.ip.btc-net.bg. [79.100.232.190]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad52d498737sm895353366b.138.2025.05.21.06.13.02 for <pve-devel@lists.proxmox.com> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 May 2025 06:13:02 -0700 (PDT) Message-ID: <8a172f9c-3927-4bff-a2c8-01184098e506@storpool.com> Date: Wed, 21 May 2025 16:13:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: pve-devel@lists.proxmox.com Content-Language: en-US From: Denis Kanchev <denis.kanchev@storpool.com> Subject: PVE child process behavior question X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy HTML_MESSAGE 0.001 HTML included in message RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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]); --===============4356554987158780151== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============4356554987158780151==--