From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id EPkeCrGHTmTuFAAASxT56A (envelope-from ) for ; Sun, 30 Apr 2023 17:22:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id ABg9CrGHTmTtDQAA9RJhRA (envelope-from ) for ; Sun, 30 Apr 2023 17:22:25 +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 9CCDD291C1 for ; Sun, 30 Apr 2023 17:22:24 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pt8sG-0005On-Bi; Sun, 30 Apr 2023 11:22:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pt8sE-0005Of-VN for bug-guix@gnu.org; Sun, 30 Apr 2023 11:22:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pt8sE-0001n3-JC for bug-guix@gnu.org; Sun, 30 Apr 2023 11:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pt8sE-0004uN-2B for bug-guix@gnu.org; Sun, 30 Apr 2023 11:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#63190: [Shepherd] Nested calls lead to a hang Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 30 Apr 2023 15:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63190 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 63190@debbugs.gnu.org Cc: mirai@makinata.eu, bjc@spork.org X-Debbugs-Original-To: bug-guix Received: via spool by submit@debbugs.gnu.org id=B.168286810518832 (code B ref -1); Sun, 30 Apr 2023 15:22:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Apr 2023 15:21:45 +0000 Received: from localhost ([127.0.0.1]:38257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pt8rw-0004tg-H8 for submit@debbugs.gnu.org; Sun, 30 Apr 2023 11:21:44 -0400 Received: from lists.gnu.org ([209.51.188.17]:49506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pt8rt-0004tW-Uk for submit@debbugs.gnu.org; Sun, 30 Apr 2023 11:21:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pt8rt-0005Ny-Mn for bug-guix@gnu.org; Sun, 30 Apr 2023 11:21:41 -0400 Received: from smtpmciv3.myservices.hosting ([185.26.107.239]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pt8rr-0001kA-Np for bug-guix@gnu.org; Sun, 30 Apr 2023 11:21:41 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv3.myservices.hosting (Postfix) with ESMTP id 637CE20354; Sun, 30 Apr 2023 17:21:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 045698009A; Sun, 30 Apr 2023 17:21:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id I3vL-6rSr5Wf; Sun, 30 Apr 2023 17:21:23 +0200 (CEST) Received: from [192.168.1.239] (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 5419280098; Sun, 30 Apr 2023 17:21:23 +0200 (CEST) Message-ID: Date: Sun, 30 Apr 2023 16:21:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Content-Language: en-US From: Bruno Victal Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=185.26.107.239; envelope-from=mirai@makinata.eu; helo=smtpmciv3.myservices.hosting X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682868144; a=rsa-sha256; cv=none; b=RHZDgimvm98EIV2/QMd2zVuczqWmTc6Gck4EIUHF0CINjgDeCLwfq8RPqRIcBCh/Pjj2lF snpE+K9u1h/sMWSrVl6sPAwN9IASY74uveyU0TESogtjSn1Qy+3566dWRZUjKxkA0q2h4V R/yppZTrQQ1mAbAaZsLS/RwuDoC0u9OrXw+lsgPiLSseX+3Y+VTEc4jUmXHMlot0dqOGpA xj/cG0+MnIHvaACLVLIzSJQlEyBVFp0K3z7YGnWh6OFmBl8c+D/dAjwgcJ47MgBuLAhIYE npnB+akSqZKBzMt4PkSpf2EtLnArcRzIMmrzYAu7oLi9p5tNnJWKusANGEE7Yw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682868144; 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: 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; bh=lN46Z1JUTiIumrhr5fLm++fIRlVjbIbMg8cXQz2McrM=; b=n4/snCcrnhILy/FT5/BdlHniwnXgdVxbJy20eUdLFZs4LQvPYsklBeyyQZVpzRkgCwMPNC /+jqIDNHeV7tR9MCuy9VbnXEnA3L9YmBS8xEKAEHgdXeoJUhkEQBVfa/R6hl3LkqQKZ8O4 6ZyNNQhDH82UX9H6YGoGBWL3NY9ORVUMguC8gDcRFzbSdGYaj+agbQkJSn9t3Ph7AxSzJE XN0PHmzRCa0y5AlaxklV8zAIgugYMfxQWJMmFpASzhZbVq2Vrw51fmzP4lraukHZ/phDgR mzujDXQhn0Aj9l3yIrQhHOqg+5NmzLmUAuHgEJd12jJbGK8SOw832D+OfO5vcQ== X-Migadu-Spam-Score: -1.91 X-Spam-Score: -1.91 X-Migadu-Queue-Id: 9CCDD291C1 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=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-TUID: j6oRsplKsX9m Original discussion (IRC): Minimal example (annotated): test-system.scm: --8<---------------cut here---------------start------------->8--- (use-modules (gnu) (gnu tests) (gnu packages) (gnu packages base) ; coreutils/sleep (gnu packages admin) ; shepherd (gnu services shepherd)) ;; Some dummy service whose start action simply waits for some seconds, ;; about enough to check with herd status before it exits. (define dummy-service-type (shepherd-service-type 'dummy (lambda (cfg) (shepherd-service (documentation "Dummy action to start service.") (provision '(dummy-service)) (respawn? #f) ; <<<<<< note, this disables the service! (modules (cons* '(gnu services herd) %default-modules)) (start #~(lambda _ (format #t "Starting a delay on dummy service.~%") (fork+exec-command (list #$(file-append coreutils "/bin/sleep") "30")))) (stop #~(make-kill-destructor)) (actions (list (shepherd-action (name 'my-action) (documentation "lorem ipsum") (procedure #~(lambda (x) ;; Scenario 1: using code from (gnu services herd), this hangs shepherd #;(start-service 'dummy) ; hangs shepherd ;; Scenario 2: this doesn't hang shepherd but do note that the service has to be re-enabled either manually or automatically here #;(system* #$(file-append shepherd "/bin/herd") "start" "dummy-service") ;; Scenario 3: use the already imported (shepherd service) module, doesn't hang shepherd ;; Like Scenario 2, the service must be re-enabled since (respawn? #f) disabled this. ;; Comment: Won't re-enabling mean that this service will relaunch once it quits? ;; That means the service has to disable itself on a successful exit, perhaps within the (stop ...) field? (start 'dummy-service)))))))) #f ; no config (description "lorem ipsum."))) (operating-system (inherit %simple-os) (services (cons* (service dummy-service-type) %base-services))) --8<---------------cut here---------------end--------------->8--- Required modifications to gnu/services/shepherd.scm for scenario 1: --8<---------------cut here---------------start------------->8--- diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index b2601c0128..158806f421 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -282,7 +282,8 @@ (define (shepherd-service-file-name service) (define (shepherd-service-file service) "Return a file defining SERVICE." (scheme-file (shepherd-service-file-name service) - (with-imported-modules %default-imported-modules + (with-imported-modules (cons '(gnu services herd) + %default-imported-modules) #~(begin (use-modules #$@(shepherd-service-modules service)) --8<---------------cut here---------------end--------------->8---