From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id wDc7E1y9LmMW2AAAbAwnHQ (envelope-from ) for ; Sat, 24 Sep 2022 10:18:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IMhKE1y9LmMq5wAA9RJhRA (envelope-from ) for ; Sat, 24 Sep 2022 10:18:36 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 04D3C29FC6 for ; Sat, 24 Sep 2022 10:18:35 +0200 (CEST) Received: from localhost ([::1]:44988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc0Ms-0004Zy-AF for larch@yhetil.org; Sat, 24 Sep 2022 04:18:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc0Ec-0005xo-DO for bug-guix@gnu.org; Sat, 24 Sep 2022 04:10:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oc0Ec-0004vT-5Q for bug-guix@gnu.org; Sat, 24 Sep 2022 04:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oc0Eb-0007yb-N8 for bug-guix@gnu.org; Sat, 24 Sep 2022 04:10:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#57922: Shepherd doesn't seem to correctly handle waitpid itself Resent-From: Josselin Poiret Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 24 Sep 2022 08:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57922 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Maxim Cournoyer , Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 57922@debbugs.gnu.org Received: via spool by 57922-submit@debbugs.gnu.org id=B57922.166400694730592 (code B ref 57922); Sat, 24 Sep 2022 08:10:01 +0000 Received: (at 57922) by debbugs.gnu.org; 24 Sep 2022 08:09:07 +0000 Received: from localhost ([127.0.0.1]:42243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oc0Di-0007xM-Op for submit@debbugs.gnu.org; Sat, 24 Sep 2022 04:09:06 -0400 Received: from jpoiret.xyz ([206.189.101.64]:40644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oc0Dg-0007xD-Ul for 57922@debbugs.gnu.org; Sat, 24 Sep 2022 04:09:05 -0400 Received: from authenticated-user (jpoiret.xyz [206.189.101.64]) by jpoiret.xyz (Postfix) with ESMTPA id 30AA1185310; Sat, 24 Sep 2022 08:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim; t=1664006941; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=talIB2iV9WeuRSS20bV8CkxBo8H3SOAfTcO7cdcc5qU=; b=SHlRxd6OVp7KWNNqtGToTvlCYm2Y1KWNqL0XKaOc0h26AFW3EGEvX+ygG55h4pdioAq4SX Hrnykmu+v+D3y6mqzfWU4OKzeG63yp10F9DacxSeN7Ja1AoRSCzaRcgjhpGji3OK5gzplL 0rnoVZpOUWHTsWKHdUfvGSswrFC5JdAjnBMFAF0S/6UBuxOD5sszEwK4+/T3jbbwaEtoP1 b01M3n36ze+pUyOk+gcuRcSeARs0kLGJEsfqKyehwUM6EZ8w+rCINUQzk5rgNE29aLXSaA /xpla6e5U4HZvBW5V/Cci87384kEey1TKhsjjjOytjW0dMI43tOADbA75GL01A== In-Reply-To: <878rm98n17.fsf@gmail.com> References: <874jx4q953.fsf@gmail.com> <87o7va33iq.fsf@jpoiret.xyz> <87bkr6fvlz.fsf@gnu.org> <878rm98n17.fsf@gmail.com> Date: Sat, 24 Sep 2022 10:09:00 +0200 Message-ID: <87sfkh8a8z.fsf@jpoiret.xyz> MIME-Version: 1.0 Content-Type: text/plain X-Spamd-Bar: / X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" Reply-to: Josselin Poiret From: Josselin Poiret via Bug reports for GNU Guix X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664007516; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=talIB2iV9WeuRSS20bV8CkxBo8H3SOAfTcO7cdcc5qU=; b=r8OVU/pPIYB5IPJH04HJa3jd4rmk2jY6UGbMgLE9CUAH7EDjBwboOF9QfQwgKA4H0qTt1A wMv2L1WVIzrJD3lQKK/1dDxcl1OXkllGo45wydOW7eXYMcRvQItw6sdVlgZ76OtnYkja4q QNwh881nhysgbdRd0t9/HBKy/33wJ9e9HhqW2eIs5eSRQ6y268cRxPEquT6pfc6advsKyy MM9FEVEpVfCsBb7zsWSdy9phT6xClK8EWZcXiukei/EcLz4r0ke0Ro9nWwUezAOjN8pwj6 Ko3JA+S8+JDk9838hDz7tohf6QPwPEj6o7zjZpXaY/iaQTdC53Jst0QMj47dkw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664007516; a=rsa-sha256; cv=none; b=Kiyfuk2vhsHCQjwfybR2kzIlSMx9esP2RnEVqTTCSp2i6vKdVgUmIBXg47OAU+HgIQze41 Ku1IMYRDyAglaRBrg3+JmLjLXhOgRd7FYzHJmQzEmTlWAMpGyKu4uXwGWtBmbQBOKRxI8g AipKOuL2Zt0sgrPiN2UkU/o9bgRFIYapEFZjLuvaOmIB9i0ZnX1/hakoJGCr5/GaaoQDpg CWkTQNGUdKGu2alBSzHF/+uvrRhCf/M7wwIRrP453e/Nq6WukmvmnuvgOiBbfckWwlmcel ONedcDRnRcOwznywM6eNwak4ZWJ5SF/tBw46oUd9P7519wGlGKqLpXXF7gDavw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=SHlRxd6O; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -1.86 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=jpoiret.xyz header.s=dkim header.b=SHlRxd6O; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 04D3C29FC6 X-Spam-Score: -1.86 X-Migadu-Scanner: scn1.migadu.com X-TUID: mCsjUI8AJfZt Hi everyone, Maxim Cournoyer writes: > This leads me to believe that Shepherd does not block until the process > is actually dead to mark the process as stopped (it just waitpid on the > group pid with WNOHANG), which means it won't block if the child process > hasn't exited yet, if I'm correct. > > When we are in the stop slot, we know for sure that the process should > terminate completely, hence it'd make sense to call 'waitpid' *without* > WNOHANG there, to avoid 'herd restart' from starting the service while > its stopped process is not done terminating. > > jamid can take quite some time to terminate cleanly because of the > networking threads in the opendht library that needs to be finalized, > which is probably the reason this problem can be observed here. > > Thoughts? I agree with you, make-kill-destructor should waitpid the processes it's killing. There shouldn't be any issues waitpid'ing before the shepherd's signal handler, since stop actions are run with asyncs disabled. The signal handler will run once but won't get anything because all the processes were already waitpid'd and it uses WNOHANG. Best, -- Josselin Poiret