From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MFKPOVyLsl7nHQAA0tVLHw (envelope-from ) for ; Wed, 06 May 2020 10:03:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4I0JKWiLsl55AQAAbx9fmQ (envelope-from ) for ; Wed, 06 May 2020 10:03:20 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::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 6B135940EDF for ; Wed, 6 May 2020 10:03:18 +0000 (UTC) Received: from localhost ([::1]:41266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWGtZ-0000co-Sa for larch@yhetil.org; Wed, 06 May 2020 06:03:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWGtK-0000Zj-Tz for bug-guix@gnu.org; Wed, 06 May 2020 06:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55275) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jWGtK-0000DD-Hj for bug-guix@gnu.org; Wed, 06 May 2020 06:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jWGtK-00080J-Eh for bug-guix@gnu.org; Wed, 06 May 2020 06:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#40981: Graphical installer tests sometimes hang. Resent-From: Mathieu Othacehe Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 06 May 2020 10:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40981 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 40981-submit@debbugs.gnu.org id=B40981.158875938130760 (code B ref 40981); Wed, 06 May 2020 10:03:02 +0000 Received: (at 40981) by debbugs.gnu.org; 6 May 2020 10:03:01 +0000 Received: from localhost ([127.0.0.1]:38588 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jWGtI-000803-Os for submit@debbugs.gnu.org; Wed, 06 May 2020 06:03:01 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:53930) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jWGtD-0007zm-Nm for 40981@debbugs.gnu.org; Wed, 06 May 2020 06:02:59 -0400 Received: by mail-wm1-f47.google.com with SMTP id k12so1882239wmj.3 for <40981@debbugs.gnu.org>; Wed, 06 May 2020 03:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=2ZFdV7c1RHiL543LjquFwl4RKmBp3aZurP08JuaEbS4=; b=MsmlbctKY/3WqiYdxw7Z6h7g+Iv0bZtcuBmXkmGEoHhJhkf20jd0VqnlrqxXi6sOIc GmKvJ/VWBMciojYwg6Hc8NKeBw2niNJV65ijgiElqYMRyXDxSSwDiLD/WCkLIZJQqbR3 fnKOCe/KlMYTeei4cCFxn6j3i/5b9WmbiUf5PuV9w19wrCs3bAsbTC+Bnryu8NDQI58z R8xzwAHt6s5IW/ydHXoc53LUhkLYCla/74r5Dem5cB1VPLXBxh5XOXqc6QIfEQ6Ahfgs cjWifsFWdKggUw4525MJdyHTEV/j6H/SH5x2iy+xzuUnETSBAUSQrkIvzSyvgEO/HVnc EIGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=2ZFdV7c1RHiL543LjquFwl4RKmBp3aZurP08JuaEbS4=; b=KYyM0PFl011bCBQGg/bfGTOVi5kN12xNwnDRfJYDiQRzIdWFxvFIkMBYnh/o9+Vohl g2UjGkeyTjNtY7fo2UQfQjYVDcz/ljAFsjdfQOsKD9sSxxtAGPE8MoW+ssT4L19ZIxnN wM92jEIyFbcJW1GsUKOPRjbZaVKeQEHFrsgcy8ZMp5n/IYar/n51BFkA4XXnyrN9+mM8 5Du3meh3sWRndFAc8g215rK3gGRZgoLLgINUXWG59l9p/P5vWjHYbS7nZR3iG7fj8nhZ j0gnlawVY1czGgr6i9RpZNQg/yReh5+H4NRuvT3YaqAgoggqIyQ2B/aIR+BaqvZmyNdg GaOg== X-Gm-Message-State: AGi0PuYXd+oMQr7ZrkT7GTsgzschkOdMU/yxjc1xLCA2/BodzfS9VaS4 Q+zwTVDWbgvYPmJEvLLr+PNuAAFL X-Google-Smtp-Source: APiQypKg/kfZjz2sCx65V+yo19mp6/JuVl32Neim4fV0vde8BL8rKe+YR0ZU9zDVcnqTq0xRzopJRQ== X-Received: by 2002:a7b:ce89:: with SMTP id q9mr3708962wmj.185.1588759369619; Wed, 06 May 2020 03:02:49 -0700 (PDT) Received: from meru ([2a01:cb18:832e:5f00:ac16:e52e:90f4:213]) by smtp.gmail.com with ESMTPSA id 92sm1899688wrm.71.2020.05.06.03.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 03:02:48 -0700 (PDT) From: Mathieu Othacehe References: <87o8r9w5re.fsf@gmail.com> <87a72ox6ws.fsf@gmail.com> <87zhanx3rw.fsf@gmail.com> <87a72mn1l2.fsf@gnu.org> <875zdael5s.fsf@gmail.com> Date: Wed, 06 May 2020 12:02:47 +0200 In-Reply-To: <875zdael5s.fsf@gmail.com> (Mathieu Othacehe's message of "Tue, 05 May 2020 12:22:23 +0200") Message-ID: <87v9l9bcu0.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 40981@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 X-Spam-Score: 0.09 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=MsmlbctK; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Scan-Result: default: False [0.09 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.49627820805474]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:142::/48:c]; R_DKIM_REJECT(1.00)[gmail.com:s=20161025]; DWL_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; FREEMAIL_FROM(0.00)[gmail.com]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.12), country: US(-0.00), ip: 2001:470:142::17(-0.50)]; DKIM_TRACE(0.00)[gmail.com:-]; RCPT_COUNT_TWO(0.00)[2]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[mothacehe@gmail.com,bug-guix-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; URIBL_BLOCKED(0.00)[elephly.net:email,zancanaro.id.au:email]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-diff]; PREVIOUSLY_DELIVERED(0.00)[40981@debbugs.gnu.org]; HAS_LIST_UNSUB(-0.01)[]; DNSWL_BLOCKED(0.00)[2001:470:142::17:from]; RCVD_COUNT_SEVEN(0.00)[9]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed),none] X-TUID: MYjML5yDCjoq --=-=-= Content-Type: text/plain Hello, I found what happened here. Turns out, when a process is forked and before "setsid" or "setpgid" is called, it shares the parent PGID. In that case the parent is Shepherd, with the PGID 0. When doing the following actions: * stop guix-daemon * start guix-daemon * stop guix-daemon * start guix-daemon If the second stop occurs after "fork" has been done, but before "setsid", then "(getpgid)" returns 0. The naive patch attached could fix the situation. WDYT? Mathieu --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-service-Fix-make-kill-destructor-when-PGID-is-zero.patch >From 0e4167251a56d6baa4f51fe72250a6e3bffae8c3 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Wed, 6 May 2020 11:48:26 +0200 Subject: [PATCH] service: Fix 'make-kill-destructor' when PGID is zero. When a process is forked, and before its GID is changed in "exec-command", it will share the parent GID, which is 0 for Shepherd. In that case, use the PID instead of the PGID. * modules/shepherd/service.scm (make-kill-destructor): Handle the case when PGID is zero, between the process fork and exec. --- modules/shepherd/service.scm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm index 8604d2f..258992c 100644 --- a/modules/shepherd/service.scm +++ b/modules/shepherd/service.scm @@ -5,6 +5,7 @@ ;; Copyright (C) 2016 Alex Kost ;; Copyright (C) 2018 Carlo Zancanaro ;; Copyright (C) 2019 Ricardo Wurmus +;; Copyright (C) 2020 Mathieu Othacehe ;; ;; This file is part of the GNU Shepherd. ;; @@ -957,11 +958,15 @@ start." "Return a procedure that sends SIGNAL to the process group of the PID given as argument, where SIGNAL defaults to `SIGTERM'." (lambda (pid . args) - ;; Kill the whole process group PID belongs to. Don't assume that PID - ;; is a process group ID: that's not the case when using #:pid-file, - ;; where the process group ID is the PID of the process that - ;; "daemonized". - (kill (- (getpgid pid)) signal) + ;; Kill the whole process group PID belongs to. Don't assume that PID is + ;; a process group ID: that's not the case when using #:pid-file, where + ;; the process group ID is the PID of the process that "daemonized". If + ;; this procedure is called, between the process fork and exec, the PGID + ;; will still be zero (the Shepherd PGID). In that case, use the PID. + (let ((pgid (getpgid pid))) + (if pgid + (kill (- pgid) signal) + (kill pid signal))) #f)) ;; Produce a constructor that executes a command. -- 2.26.0 --=-=-=--