From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 D1FA8689D6 for ; Wed, 11 Nov 2020 10:15:08 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BE57B2A66B for ; Wed, 11 Nov 2020 10:14:38 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS id 487B52A65E for ; Wed, 11 Nov 2020 10:14:38 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 0DB0441FB1 for ; Wed, 11 Nov 2020 10:14:38 +0100 (CET) To: Proxmox Backup Server development discussion , Dominik Csapak References: <20201111082751.7358-1-d.csapak@proxmox.com> From: Thomas Lamprecht Message-ID: <2907b557-dbeb-fd7d-dc12-9e01b9939f24@proxmox.com> Date: Wed, 11 Nov 2020 10:14:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Thunderbird/83.0 MIME-Version: 1.0 In-Reply-To: <20201111082751.7358-1-d.csapak@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.101 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox-backup-proxy.rs, proxmox-backup-api.rs, daemon.rs] Subject: [pbs-devel] applied: [PATCH proxmox-backup v2] daemon: add hack for sd_notify X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2020 09:15:08 -0000 On 11.11.20 09:27, Dominik Csapak wrote: > sd_notify is not synchronous, iow. it only waits until the message > reaches the queue not until it is processed by systemd > > when the process that sent such a message exits before systemd could > process it, it cannot be associated to the correct pid > > so in case of reloading, we send a message with 'MAINPID=' > to signal that it will change. if now the old process exits before > systemd knows this, it will not accept the 'READY=1' message from the > child, since it rejects the MAINPID change > > since there is no (AFAICS) library interface to check the unit status, > we use 'systemctl is-active ' to check the state until > it is not 'reloading' anymore. > > on newer systemd versions, there is 'sd_notify_barrier' which would > allow us to wait for systemd to have all messages from the current > pid to be processed before acknowledging to the child, but on buster > the systemd version is to old... > > Signed-off-by: Dominik Csapak > --- > changes from v1: > * only check the state in the parent pid, do not send ready > in the child in a loop > * changed the comment to include "FIXME" > src/bin/proxmox-backup-api.rs | 1 + > src/bin/proxmox-backup-proxy.rs | 1 + > src/tools/daemon.rs | 26 ++++++++++++++++++++++++++ > 3 files changed, 28 insertions(+) > > applied, thanks! With the followups we spoke off-list.