From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4NBQAzx22GKqDAEAbAwnHQ (envelope-from ) for ; Wed, 20 Jul 2022 23:40:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mB5GAzx22GLbLAEAauVa8A (envelope-from ) for ; Wed, 20 Jul 2022 23:40:12 +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 B593012B5C for ; Wed, 20 Jul 2022 23:40:11 +0200 (CEST) Received: from localhost ([::1]:41472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEHQQ-0001PT-TH for larch@yhetil.org; Wed, 20 Jul 2022 17:40:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEHQI-0001PK-Lh for bug-guix@gnu.org; Wed, 20 Jul 2022 17:40:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46448) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oEHQI-0001Ye-C6 for bug-guix@gnu.org; Wed, 20 Jul 2022 17:40:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oEHQI-0005Id-0i for bug-guix@gnu.org; Wed, 20 Jul 2022 17:40:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#56674: [Shepherd] Use of =?UTF-8?Q?=E2=80=98waitpid=E2=80=99, _?= =?UTF-8?Q?=E2=80=98system*=E2=80=99, ?= etc. in service code can cause deadlocks Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 20 Jul 2022 21:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 56674 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 56674@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.165835315420280 (code B ref -1); Wed, 20 Jul 2022 21:40:01 +0000 Received: (at submit) by debbugs.gnu.org; 20 Jul 2022 21:39:14 +0000 Received: from localhost ([127.0.0.1]:36196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oEHPW-0005H1-FD for submit@debbugs.gnu.org; Wed, 20 Jul 2022 17:39:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:56904) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oEHPT-0005Gs-NI for submit@debbugs.gnu.org; Wed, 20 Jul 2022 17:39:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34104) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEHPT-0001Ia-IN for bug-guix@gnu.org; Wed, 20 Jul 2022 17:39:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:39164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEHPT-0001TV-AK for bug-guix@gnu.org; Wed, 20 Jul 2022 17:39:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=M8w5WeDxJS14gBGGsfc8CvBrW4CYqhv18DUTdfvx+EU=; b=HBRZBuMtbWN9u3 zm3KRNpSPuVelXLB6WvH2dvU2YbVqCxFLNGQkiD8MfxsjY9q78jQeQQK5OB/8MRhI7UaSsfEjgy/w zDOEyY7mCcTyPZXHaGLEzO/3m+00nAz4K39gCA5KEHYkkYl18VW1r7GAyU6jvhBpikmlXtCPjr8vF CIds4JmF3KO6LCWdCEBf+23EPMNoerp9LFcaZisTscpqoTbhTVU4wsm/ZISSuO1Va7LWi2cc1ofKX 0shWBs0cxQhIuqvl9bmnPZiqSoZ2pTgZ3Gy0/GyrtLu1SMRSoIoiwnUkn/3HctM2lxfZoGb0HDvxz udLc9tiWBxbuQjp9g9Dw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:64292 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEHPS-00062Y-F2 for bug-guix@gnu.org; Wed, 20 Jul 2022 17:39:11 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Duodi 2 Thermidor an 230 de la =?UTF-8?Q?R=C3=A9volution, ?= jour du Bouillon-blanc X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Wed, 20 Jul 2022 23:39:08 +0200 Message-ID: <8735evpipv.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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" 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=1658353211; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=M8w5WeDxJS14gBGGsfc8CvBrW4CYqhv18DUTdfvx+EU=; b=h/8m+8qwCq5sxSXUqnoScDxNi2gMlQw/A0OHB7RAPpq2QEcCvVIo02uFREoOsHEJdxkzac aOp2Yf4jfPLSkKEV1Fe6tqFBfoCNmy89BGg4fia9ILUT63NMo0SPHg0sddRTTb/1H59DMb 8ZklxKdM2exV4IxX75DjYuJ+RyD/BmialSNsyTHI0mlZtm0BmkCOYNP/kiNHDqDjecpWvx t5bzagJx4jiR1+GIjpGA0jIV3WJQtk+OYYhiclPCD+PPMp1X6rsaqECVgyD9dHD4oRRM1c 3teAUY70k//Ml98D5VBfWQQdgJSHq+RodsXTWxe5qW2eal8mr8hutDBH22XA/Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658353211; a=rsa-sha256; cv=none; b=FL87s5Q05cOwZGn8R/+N+P/pAwfEVZHGDwCZzxmEY/t1SDXhDNFVEFIk3J8lmA3OPt3Dct 5tuP+tu/xf+CMORToVQsDR3OeApqGl2QqmpdubGIAQXMuHUgJKoX4IIi/Elo5zQH/+1lXd 8RApFH5cSqj3BxVpnj1A0qxP9aePk4aNtcErEBiU/xdnc89kBQSKk6KSH6yhcUOhalnX3a Jo9BRYAUmxEsypHJxEcw8aCA0mEJTsdEIA2GKd6wQLq0AmmWmG6azxj7/zN5Cd7d3g+rPN F9YtX9PS0HkbUF+OFtFDzracEYAzt9REjd1/gITeTKdphxk4b13y+kslUO6LZw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=HBRZBuMt; 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: -2.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=HBRZBuMt; 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: B593012B5C X-Spam-Score: -2.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: vd+QmDpW3mUx Hi! We=E2=80=99ve just had a bad experience with the nginx service on berlin, w= here =E2=80=98herd restart nginx=E2=80=99 would cause shepherd to get stuck fore= ver in =E2=80=98waitpid=E2=80=99 on the process that was supposed to start nginx. The details are unclear, but one thing is clear is that using =E2=80=98wait= pid=E2=80=99 (either directly or indirectly with =E2=80=98system*=E2=80=99, which is what =E2=80=98nginx-service-type=E2=80=99 does) is not great: 1. In the best case, shepherd (as of 0.9.1) is stuck while =E2=80=98syste= m*=E2=80=99 is in =E2=80=98waitpid=E2=80=99 waiting for child process completion (= =E2=80=9Cstuck=E2=80=9D as in: doesn=E2=80=99t do anything, not even answering =E2=80=98herd=E2= =80=99 requests or inetd connections.) 2. I don=E2=80=99t think that can happen with =E2=80=98system*=E2=80=99 (= because it=E2=80=99s in C), but generally speaking, there=E2=80=99s a possibility that shepherd=E2= =80=99s event loop will handle child process termination before some other user-made =E2=80=98waitpid=E2=80=99 call does. Anyway, that=E2=80=99s a bad situation. So I can think of several ways to address it: 1. Change the nginx service =E2=80=98stop=E2=80=99 method to just (make-kill-destructor), which should work just as well as invoking =E2=80=9Cnginx -s stop=E2=80=9D. 2. Have Shepherd provide a replacement for =E2=80=98system*=E2=80=99. Thoughts? Ludo=E2=80=99.