From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 SCaiMPLLR2NoWgAAbAwnHQ (envelope-from ) for ; Thu, 13 Oct 2022 10:27:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sDe/MPLLR2PpwQAA9RJhRA (envelope-from ) for ; Thu, 13 Oct 2022 10:27:30 +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 8CEDE304AF for ; Thu, 13 Oct 2022 10:27:30 +0200 (CEST) Received: from localhost ([::1]:57310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oitYv-0004FL-JL for larch@yhetil.org; Thu, 13 Oct 2022 04:27:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oit1a-0008S0-G2 for bug-guix@gnu.org; Thu, 13 Oct 2022 03:53:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60245) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oit1a-00073P-7m for bug-guix@gnu.org; Thu, 13 Oct 2022 03:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oit1a-0003f3-0j for bug-guix@gnu.org; Thu, 13 Oct 2022 03:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#58485: [shepherd] Restarting guix-publish fails Resent-From: Lars-Dominik Braun Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 13 Oct 2022 07:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58485 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 58485@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166564754014022 (code B ref -1); Thu, 13 Oct 2022 07:53:01 +0000 Received: (at submit) by debbugs.gnu.org; 13 Oct 2022 07:52:20 +0000 Received: from localhost ([127.0.0.1]:59323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oit0t-0003e5-VF for submit@debbugs.gnu.org; Thu, 13 Oct 2022 03:52:20 -0400 Received: from lists.gnu.org ([209.51.188.17]:40908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oit0s-0003dy-Dp for submit@debbugs.gnu.org; Thu, 13 Oct 2022 03:52:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oit0s-0007iw-6t for bug-guix@gnu.org; Thu, 13 Oct 2022 03:52:18 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]:35356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1oit0p-0006z4-KS; Thu, 13 Oct 2022 03:52:17 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Mp1v42TyZz9sQZ; Thu, 13 Oct 2022 09:52:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6xq.net; s=MBO0001; t=1665647520; 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; bh=SMqqMpHn961PiS0hBZWdIlSPBYOeAlSPqkbO8gVO4l8=; b=k4WGz2+Tj4BGi83ztOm3PSII4DymTcfhZjc8AtzYc1Q2Enp8qy6855ZBzvo4Io9hk8LKpk 7SPZl/VaINsW4qb7IUVdKgQwuPxSHtycFFkP6se5O4U0t564X9FBPKDTS6lWaZn0OTL3BA tkRm3g32s3HNez/TippfJ7yvqxGBGf7Sxk+eXDsz96IfhSRoOchxjNlxI77/3wPt/nXF8w IKPwIDn+lEKnQ08xjuMJ+G0SSXCijgeu3UpVyHAKGjNX9buGJcwzjedJNGMbaHbR769pe0 8ZU0KIuFISl2BZmTa0qD2A82g03xcnHb7UWq+BRXBBAsaZcw/inTIMb6u/dpVQ== Date: Thu, 13 Oct 2022 09:51:58 +0200 From: Lars-Dominik Braun Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 4Mp1v42TyZz9sQZ Received-SPF: pass client-ip=80.241.56.151; envelope-from=lars@6xq.net; helo=mout-p-101.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665649650; h=from:from:sender:sender: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:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=SMqqMpHn961PiS0hBZWdIlSPBYOeAlSPqkbO8gVO4l8=; b=AFvBNHgaAldZxCQEP9ZhbKrk6GcSZJmBsTAkPr+LsGx6JwiHkvpBEtNx13QtbAaURD7JLU REPaJYuvhWI8E9MfbJf6Q7KruxFx7tisEvz67UKS54N6xrfTvCK2kibSx1C2nIVvFC3OZf r9K/Mlkg1FnQb+GNioFQG7A4XjC+r8G635Vs78OrVQ/UQgbo14yeH6QPGhgWHbTlfBgz+Z DrskkkQFNuIAM4Uber/uux8YxKkm048CLQ2c/b9XNNAHAQ7+HvSAMRMCFPNJL/SD0UytPt vvHtSP9ftqG7KS43A0xNadU7t5gnRupVSsTLyXU+DgQZBAr2q6KPxfPTGJW3LA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665649650; a=rsa-sha256; cv=none; b=aWhEyqE0OD5g6wVgDVTcPUgN2zX3XduGdJDWYQpTI+/Ra/mvdjyme/i3dgqWKeN05nRNNK EJgyAhAwk9dOnS7ZoKRoIKNyz/LDgDQBzfHwBKsZzFblpFgwplFZEr0N7LhxyIdTHpVIpa Di6WpwJS2R/V5CElxoUOem/KS8VMywfsvUGhchGFWY42ZOY9mmbAwEMHErgw011CpzbIdr 8PLHG4SsKjtBw6Lj6PJL1i8Bs87SA2VBfWCdVaGwCcW/VuXv2KxTZ6nTiypiwoYwOdO71c RdIckTOTs6LNpBSsl4fHi8W0tbK2MEQDoQlQ7JMUDvxQ3Zx2FLQoz3vPR6e3AQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=k4WGz2+T; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=none); 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: 7.20 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=6xq.net header.s=MBO0001 header.b=k4WGz2+T; dmarc=fail reason="SPF not aligned (relaxed)" header.from=6xq.net (policy=none); 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: 8CEDE304AF X-Spam-Score: 7.20 X-Migadu-Scanner: scn1.migadu.com X-TUID: /BN8P55MCO5N Hi, it seems that `herd restart guix-publish` stopped working after the introduction of socket activation into shepherd. This is a problem, because I restart guix-publish automatically after unattended-upgrades. It fails with the following error for me: ---snip--- Backtrace: 7 (primitive-load "/gnu/store/7xrg2sbb529ki6hv99n27svg0fi?") In ice-9/boot-9.scm: 724:2 6 (call-with-prompt ("prompt") # ?) 1752:10 5 (with-exception-handler _ _ #:unwind? _ # _) In ice-9/eval.scm: 619:8 4 (_ #(#(#))) In ice-9/boot-9.scm: 260:13 3 (for-each # _) In gnu/services/herd.scm: 168:4 2 (invoke-action guix-publish restart () #) 176:7 1 (failure) In ice-9/boot-9.scm: 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: ERROR: 1. &action-exception-error: service: guix-publish action: start key: system-error args: ("bind" "~A" ("Address already in use") (98)) ---snap--- Note that due to the socket activation you must visit the URL at least once to start up the guix-publish process. Otherwise a restart will work fine. It also works fine the second time I invoke `herd restart guix-publish`, because `guix-publish` is dead by that time. Looking at an strace shepherd is indeed trying to kill `guix-publish` and re-bind to the same address: ---snip--- 1 read(23, "(shepherd-command (version 0) (action restart) (service guix-publish) (arguments ()) (directory \"/root\"))", 1024) = 105 1 getpgid(18096) = 18096 1 getpgid(0) = 0 1 kill(-18096, SIGTERM) = 0 1 newfstatat(AT_FDCWD, "/etc/localtime", {st_mode=S_IFREG|0444, st_size=2298, ...}, 0) = 0 1 write(17, "shepherd[1]: Service guix-publish has been stopped.\n", 52) = 52 1 socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 36 1 setsockopt(36, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 1 bind(36, {sa_family=AF_INET, sin_port=htons(8082), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EADDRINUSE (Address already in use) 1 write(23, "(reply (version 0) (result #f) (error (error (version 0) action-exception start guix-publish system-error (\"bind\" \"~A\" (\"Address already in use\") (98)))) (messages (\"Service guix-publish has been stopped.\")))", 208) = 208 1 close(23) ---snap--- The obvious explanation would be that stopping does not wait for the process to actually exit. make-kill-destructor does not waitpid it seems and 'running is set unconditionally to #f after 'stop has finished. Cheers, Lars