From unknown Fri Jun 20 18:05:41 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#61803 <61803@debbugs.gnu.org> To: bug#61803 <61803@debbugs.gnu.org> Subject: Status: [PATCH 0/3] [shepherd] improve race-free spawn+wait Reply-To: bug#61803 <61803@debbugs.gnu.org> Date: Sat, 21 Jun 2025 01:05:41 +0000 retitle 61803 [PATCH 0/3] [shepherd] improve race-free spawn+wait reassign 61803 guix-patches submitter 61803 Ulf Herrman severity 61803 normal tag 61803 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 03:31:22 2023 Received: (at submit) by debbugs.gnu.org; 26 Feb 2023 08:31:22 +0000 Received: from localhost ([127.0.0.1]:42287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWCRD-0005LJ-BK for submit@debbugs.gnu.org; Sun, 26 Feb 2023 03:31:22 -0500 Received: from lists.gnu.org ([209.51.188.17]:49856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pW2iF-0006yJ-Ld for submit@debbugs.gnu.org; Sat, 25 Feb 2023 17:08:16 -0500 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 1pW2iF-0003ji-DN for guix-patches@gnu.org; Sat, 25 Feb 2023 17:08:15 -0500 Received: from tilde.club ([2607:5300:204:4340::114]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pW2iD-0005B2-8c for guix-patches@gnu.org; Sat, 25 Feb 2023 17:08:15 -0500 Received: by tilde.club (Postfix, from userid 5378) id DA07B220B360C; Sat, 25 Feb 2023 22:08:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club DA07B220B360C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1677362887; bh=d/Jb/ZYM6YsbWvuZyUZ8Uxm81yEvsmppozkuXCRm9wU=; h=From:To:Subject:Date:From; b=akrLCwLuKpjHpbiZVZIa2GX7CyNlO3Q/ey78T85zSVKCVg0ZXn2QH67mB7eyTOH7+ /AENJkJv7rg4Z4ltlL06eL/xlpOW6R/so2SlPYgCmXP8Dio7J4upX0RlyFZz52omRQ NK3fY8Alc3oU6tpOLrRr+yPcJGA0eSr+TNMlv33w= From: Ulf Herrman To: guix-patches@gnu.org Subject: [PATCH 0/3] [shepherd] improve race-free spawn+wait User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Date: Sat, 25 Feb 2023 16:08:01 -0600 Message-ID: <87cz5x1jr2.fsf@tilde.club> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=2607:5300:204:4340::114; envelope-from=striness@tilde.club; helo=tilde.club X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 26 Feb 2023 03:31:18 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain These patches fill out shepherd's procedures for running processes to completion. They add a replacement for 'system' to complement the existing replacement for 'system*', and add a 'fork+exec+wait-process' procedure so that the flexibility of that family of procedures is available for this use case as well. It also improves error handling in the event that an exception occurs while spawning a process in the process monitor, which would normally kill that essential fiber. Note: I previously tried to send this to guix-devel, but it didn't seem to make it (I didn't see it in the archives after half a day), and after some consideration I recalled that guix-patches exists. Is this the right place for shepherd patches? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-service-Propagate-exceptions-while-spawning-in-proce.patch Content-Transfer-Encoding: quoted-printable From=2064370a98dfc17f0531de7397a38362c03a1d89bc Mon Sep 17 00:00:00 2001 From: ulfvonbelow Date: Sat, 25 Feb 2023 00:42:41 -0600 Subject: [PATCH 1/3] service: Propagate exceptions while spawning in process monitor. * modules/shepherd/service.scm (unboxed-errors): new procedure. (boxed-errors): new syntax. (process-monitor): use it to propagate exceptions from fork+exec-command = via reply channel. (spawn-via-monitor): new procedure. (spawn-command): use it. =2D-- modules/shepherd/service.scm | 47 ++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm index fd2ef1b..196ee44 100644 =2D-- a/modules/shepherd/service.scm +++ b/modules/shepherd/service.scm @@ -1825,6 +1825,24 @@ otherwise by updating its state." ;; loop so we don't miss any terminated child process. (loop))))) =20 +(define-syntax-rule (boxed-errors exps ...) + (catch #t + (lambda () + (call-with-values + (lambda () + exps ...) + (lambda results + (list 'success results)))) + (lambda args + (list 'exception args)))) + +(define unboxed-errors + (match-lambda + (('success vals) + (apply values vals)) + (('exception args) + (apply throw args)))) + (define (process-monitor channel) "Run a process monitor that handles requests received over @var{channel}= ." (let loop ((waiters vlist-null)) @@ -1860,11 +1878,17 @@ otherwise by updating its state." waiters))) =20 (('spawn command reply) =2D ;; Spawn COMMAND; send its exit status to REPLY when it terminate= s. =2D ;; This operation is atomic: the WAITERS table is updated before =2D ;; termination of PID can possibly be handled. =2D (let ((pid (fork+exec-command command))) =2D (loop (vhash-consv pid reply waiters)))) + ;; Spawn COMMAND; send the spawn result (pid or exception) to REPLY; + ;; send its exit status to REPLY when it terminates. This operatio= n is + ;; atomic: the WAITERS table is updated before termination of PID c= an + ;; possibly be handled. + (let ((result (boxed-errors (fork+exec-command command)))) + (put-message reply result) + (match result + (('exception . _) + (loop waiters)) + (('success (pid)) + (loop (vhash-consv pid reply waiters)))))) =20 (('await pid reply) ;; Await the termination of PID and send its status on REPLY. @@ -1900,14 +1924,17 @@ context. The process monitoring fiber is responsib= le for handling @code{SIGCHLD} and generally dealing with process creation and termination= ." (call-with-process-monitor (lambda () exp ...))) =20 +(define (spawn-via-monitor command) + (let ((reply (make-channel))) + (put-message (current-process-monitor) + `(spawn ,command ,reply)) + (unboxed-errors (get-message reply)) + (get-message reply))) + (define (spawn-command program . arguments) "Like 'system*' but do not block while waiting for PROGRAM to terminate." (if (current-process-monitor) =2D (let ((reply (make-channel))) =2D (put-message (current-process-monitor) =2D `(spawn ,(cons program arguments) =2D ,reply)) =2D (get-message reply)) + (spawn-via-monitor (cons program arguments)) (apply system* program arguments))) =20 (define default-process-termination-grace-period =2D-=20 2.38.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-service-accept-fork-exec-command-argument-list-in-mo.patch Content-Transfer-Encoding: quoted-printable From=2051ee63ace6f3f52eb196c990664cc6b9af3d3683 Mon Sep 17 00:00:00 2001 From: ulfvonbelow Date: Sat, 25 Feb 2023 00:46:27 -0600 Subject: [PATCH 2/3] service: accept fork+exec-command argument list in monitor. Sometimes it's necessary to run startup / shutdown programs as a certain us= er, in a certain directory, with certain environment variables, etc. Shepherd currently provides a replacement for system* that won't race against the child process auto-reaper, but this lacks the flexibility Shepherd users are used to. * modules/shepherd/service.scm (process-monitor): treat command instead as argument list to fork+exec-command. (spawn-via-monitor): update to new convention. (fork+exec+wait-command): new procedure. =2D-- modules/shepherd/service.scm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm index 196ee44..a36e486 100644 =2D-- a/modules/shepherd/service.scm +++ b/modules/shepherd/service.scm @@ -94,6 +94,7 @@ default-process-termination-grace-period exec-command fork+exec-command + fork+exec+wait-command default-pid-file-timeout read-pid-file make-system-constructor @@ -1877,12 +1878,12 @@ otherwise by updating its state." vlist-null waiters))) =20 =2D (('spawn command reply) + (('spawn args reply) ;; Spawn COMMAND; send the spawn result (pid or exception) to REPLY; ;; send its exit status to REPLY when it terminates. This operatio= n is ;; atomic: the WAITERS table is updated before termination of PID c= an ;; possibly be handled. =2D (let ((result (boxed-errors (fork+exec-command command)))) + (let ((result (boxed-errors (apply fork+exec-command args)))) (put-message reply result) (match result (('exception . _) @@ -1924,19 +1925,26 @@ context. The process monitoring fiber is responsib= le for handling @code{SIGCHLD} and generally dealing with process creation and termination= ." (call-with-process-monitor (lambda () exp ...))) =20 =2D(define (spawn-via-monitor command) +(define (spawn-via-monitor arguments) (let ((reply (make-channel))) (put-message (current-process-monitor) =2D `(spawn ,command ,reply)) + `(spawn ,arguments ,reply)) (unboxed-errors (get-message reply)) (get-message reply))) =20 (define (spawn-command program . arguments) "Like 'system*' but do not block while waiting for PROGRAM to terminate." (if (current-process-monitor) =2D (spawn-via-monitor (cons program arguments)) + (spawn-via-monitor (list (cons program arguments))) (apply system* program arguments))) =20 +(define (fork+exec+wait-command command . arguments) + "Like 'fork+exec' but also wait for PROGRAM to terminate, giving its exit +status." + (if (current-process-monitor) + (spawn-via-monitor (cons command arguments)) + (waitpid (apply fork+exec-command command arguments)))) + (define default-process-termination-grace-period ;; Default process termination "grace period" before we send SIGKILL. (make-parameter 5)) =2D-=20 2.38.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-service-add-spawn-shell-command-replacement-for-syst.patch Content-Transfer-Encoding: quoted-printable From=20177592ee9d4b7fc6dcc80e545e8ad615a1d6786c Mon Sep 17 00:00:00 2001 From: ulfvonbelow Date: Sat, 25 Feb 2023 00:56:57 -0600 Subject: [PATCH 3/3] service: add spawn-shell-command replacement for `system'. We already have a replacement for `system*' that avoids racing, but not for `system'. * configure.ac (SHELL): new substitution variable. * modules/shepherd/system.scm.in (%shell-filename): new variable. * modules/shepherd/service.scm (spawn-shell-command, real-system): new procedures. * modules/shepherd.scm (main): replace `system' with `spawn-shell-command'. =2D-- configure.ac | 1 + modules/shepherd.scm | 7 +++++-- modules/shepherd/service.scm | 13 +++++++++++++ modules/shepherd/system.scm.in | 5 ++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 6f681dc..19c177a 100644 =2D-- a/configure.ac +++ b/configure.ac @@ -32,6 +32,7 @@ guilemoduledir=3D"${datarootdir}/guile/site/$GUILE_EFFECT= IVE_VERSION" guileobjectdir=3D"${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache" AC_SUBST([guilemoduledir]) AC_SUBST([guileobjectdir]) +AC_SUBST([SHELL]) =20 dnl Check for extra dependencies. GUILE_MODULE_AVAILABLE([have_fibers], [(fibers)]) diff --git a/modules/shepherd.scm b/modules/shepherd.scm index cce0507..1f6342e 100644 =2D-- a/modules/shepherd.scm +++ b/modules/shepherd.scm @@ -420,8 +420,10 @@ already ~a threads running, disabling 'signalfd' suppo= rt") =20 ;; Replace the default 'system*' binding with one that ;; cooperates instead of blocking on 'waitpid'. =2D (let ((real-system* system*)) + (let ((real-system* system*) + (real-system system)) (set! system* spawn-command) + (set! system spawn-shell-command) =20 ;; Restore 'system*' after fork. (set! primitive-fork @@ -430,7 +432,8 @@ already ~a threads running, disabling 'signalfd' suppor= t") (let ((result (real-fork))) (when (zero? result) (set! primitive-fork real-fork) =2D (set! system* real-system*)) + (set! system* real-system*) + (set! system real-system)) result))))) =20 (run-daemon #:socket-file socket-file diff --git a/modules/shepherd/service.scm b/modules/shepherd/service.scm index a36e486..f8df3a9 100644 =2D-- a/modules/shepherd/service.scm +++ b/modules/shepherd/service.scm @@ -81,6 +81,7 @@ handle-SIGCHLD with-process-monitor spawn-command + spawn-shell-command %precious-signals register-services provided-by @@ -1938,6 +1939,18 @@ context. The process monitoring fiber is responsibl= e for handling (spawn-via-monitor (list (cons program arguments))) (apply system* program arguments))) =20 +(define real-system system) + +(define* (spawn-shell-command #:optional command) + "Like 'system' but do not block while waiting for COMMAND to terminate." + (if (current-process-monitor) + (if command + (spawn-command %shell-filename "-c" command) + #t) + (if command + (real-system command) + (real-system)))) + (define (fork+exec+wait-command command . arguments) "Like 'fork+exec' but also wait for PROGRAM to terminate, giving its exit status." diff --git a/modules/shepherd/system.scm.in b/modules/shepherd/system.scm.in index 29357aa..4646e81 100644 =2D-- a/modules/shepherd/system.scm.in +++ b/modules/shepherd/system.scm.in @@ -41,7 +41,8 @@ unblock-signals set-blocked-signals with-blocked-signals =2D without-automatic-finalization)) + without-automatic-finalization + %shell-filename)) =20 ;; The constants. (define RB_AUTOBOOT @RB_AUTOBOOT@) @@ -328,3 +329,5 @@ Turning finalization off shuts down the finalization th= read as a side effect." exp ...) (lambda () (%set-automatic-finalization-enabled?! enabled?))))) + +(define %shell-filename "@SHELL@") =2D-=20 2.38.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHIBAEBCAAyFiEEn6BUn0yca1D9JsMa1lV76sJM9mgFAmP6hsEUHHN0cmluZXNz QHRpbGRlLmNsdWIACgkQ1lV76sJM9mjtsQwAiDIHp3DBdkOB1nWU5iU9WgVZHnvg NpMxQhI0trcEluiMYltryxtyv9y4L0x1O2hKto+KbDdvS6l6NHF6IfGX4aV7hfq+ PJBntv3KQjK5NTPN96+D179aLeb8iCY//rh2/qjdLALtqxGHM8kcf83se1SQ3mr/ UtChBtz5vNQKJx3s7PSOAhGvLupNJ6rWdgKdm+BwbsWFZ/7lrb3+gNLXPMtQlEzC 3jgo7TKVEMhLLVuoYRsvCx79a5l5kayaA516B+xuKLGY3/OZIU/VT5Ts5tzAlhDU VjTI4Wg1aKyZJDehuFwbYuoPWwxnODOhZ05fZKlKDqMhBRWsFnsPR355dU2uOY4I ku4HkuvpQBHj1TPp7JqxRZ+cwU76REjoEjqJPNfKriIZj97/+OrPz/hdX8GLwPRY Uwc/IZyoa5HAYKKpPyeBaZAmEJ8hxrA576nEIetuXmfFvSeheuSYw+5Qe6NujX/M wtuZEi1t3SsHHjbCwNf9LQXPehBRVmRwtC0j =FusD -----END PGP SIGNATURE----- --==-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 26 09:22:33 2023 Received: (at 61803) by debbugs.gnu.org; 26 Feb 2023 14:22:33 +0000 Received: from localhost ([127.0.0.1]:42809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWHv6-0000u0-Up for submit@debbugs.gnu.org; Sun, 26 Feb 2023 09:22:33 -0500 Received: from tobias.gr ([80.241.217.52]:46898) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWHv4-0000tq-DQ for 61803@debbugs.gnu.org; Sun, 26 Feb 2023 09:22:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=TWcQq5KmoZDk/ Bul+GqoIPGSLZKUqXNfg3D0qjCWJVU=; h=in-reply-to:date:subject:cc:to: from:references; d=tobias.gr; b=ZYsSfsb7wE+BZuozBo0b2zp9VhqE9c760G+QY6 yWpo0btsnvdGH7DtczZrEl5ljDu38yIYm0Ve7o9t6+fyEJgyFnkHrfsaKTXkvr7wb7evUW CDUugI+fabCtY8pLbj1s310mpE745AntCuYmtKUsFJ++VPK2OmtGSjRPcDBkg3lJaDpx4X 95/GQwPy7tXbUJxvwIM1Sba76AjOmPMdc4ega7ENGPcMUMmUFGoN2xByEDkiSotXhuRlo1 p9h4uzs76lfeyV84hBiJw6mvlmDNvuf4swR2pDU9U5acCtI/50a+bBeLWMRrYw7Oykbr8V ZT7WyM0TahlOZmx2q6lzQ3Iw== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 38e0135c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 26 Feb 2023 14:22:26 +0000 (UTC) References: <87cz5x1jr2.fsf@tilde.club> From: Tobias Geerinckx-Rice To: Ulf Herrman Subject: Re: [bug#61803] [PATCH 0/3] [shepherd] improve race-free spawn+wait Date: Sun, 26 Feb 2023 15:17:08 +0100 In-reply-to: <87cz5x1jr2.fsf@tilde.club> BIMI-Selector: v=BIMI1; s=default; Message-ID: <87ttz8v715.fsf@nckx> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61803 Cc: 61803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Ulf, Ulf Herrman =E5=86=99=E9=81=93=EF=BC=9A > Note: I previously tried to send this to guix-devel, but it=20 > didn't seem > to make it (I didn't see it in the archives after half a day), Note: I only check the spam/moderation queue once a day, most days=20 ;-) > and=20 > after > some consideration I recalled that guix-patches exists. Is this=20 > the > right place for shepherd patches? It is! If you like, you can configure =E2=80=98git send-email=E2=80=99 to default = to=20 guix-patches@gnu.org (sendemail.to). It will send separate mails=20 for each patch rather than attachments. Kind regards, T G-R --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIIEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCY/trpg0cbWVAdG9iaWFz LmdyAAoJEA2w/4hPVW15JogA/jtYf1cvINbLokGuSZzrBpnborN35ZMdF7VbDbsH nKh9APiy/eKBvrywSugykEx4Ao77226bwInDwi3qNchMk+UG =hNjy -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 02 17:16:49 2023 Received: (at 61803) by debbugs.gnu.org; 2 Mar 2023 22:16:49 +0000 Received: from localhost ([127.0.0.1]:58557 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXrEG-0003hE-J8 for submit@debbugs.gnu.org; Thu, 02 Mar 2023 17:16:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXrEE-0003h1-Nn for 61803@debbugs.gnu.org; Thu, 02 Mar 2023 17:16:47 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXrE5-0006W5-TS; Thu, 02 Mar 2023 17:16:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=eUNM/dLNxxnB1qM90OoGm/oBFTOp8JKPiqi9YPEDLtA=; b=Djq6GpKZYx1upAMEfDCZ LeGwKl+GbZD05nH5a5s3bpYdrt+y/uUvSWEj259VuaESZ+BVr6yB419lQSlipTB7hq89s8bIL7Hp7 NSx0gwBysOlyd03DRS01gRzMJMWVoronDg/rvpPdvJfFiGQqTVd8kLWrnyl5E3SN172sbS4QAoBOr k/hyLhcJdzG6L/J4mb+plTNEADPst7lKC4ERIxZWR7b+cSc9031E0n/7bPHzTadkKXShVbr52uBSc 9YCG1Sy7PjbWrMBW0iWl8u9V8OoFrM9K4tPchLWDB8GChxFPfGOvlQz/cymNtTjI8G2zXE5ouqOP4 3v9kVo4yuJ4yMw==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXrE3-0005xc-U8; Thu, 02 Mar 2023 17:16:37 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Ulf Herrman Subject: Re: bug#61803: [PATCH 0/3] [shepherd] improve race-free spawn+wait References: <87cz5x1jr2.fsf@tilde.club> Date: Thu, 02 Mar 2023 23:16:33 +0100 In-Reply-To: <87cz5x1jr2.fsf@tilde.club> (Ulf Herrman's message of "Sat, 25 Feb 2023 16:08:01 -0600") Message-ID: <87h6v23ike.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61803 Cc: 61803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Ulf, Ulf Herrman skribis: > These patches fill out shepherd's procedures for running processes to > completion. They add a replacement for 'system' to complement the > existing replacement for 'system*', and add a 'fork+exec+wait-process' > procedure so that the flexibility of that family of procedures is > available for this use case as well. It also improves error handling in > the event that an exception occurs while spawning a process in the > process monitor, which would normally kill that essential fiber. Nice! > Note: I previously tried to send this to guix-devel, but it didn't seem > to make it (I didn't see it in the archives after half a day), and after > some consideration I recalled that guix-patches exists. Is this the > right place for shepherd patches? Yes, as Tobias confirmed already. :-) > From 64370a98dfc17f0531de7397a38362c03a1d89bc Mon Sep 17 00:00:00 2001 > From: ulfvonbelow > Date: Sat, 25 Feb 2023 00:42:41 -0600 > Subject: [PATCH 1/3] service: Propagate exceptions while spawning in proc= ess > monitor. > > * modules/shepherd/service.scm (unboxed-errors): new procedure. > (boxed-errors): new syntax. > (process-monitor): use it to propagate exceptions from fork+exec-comman= d via > reply channel. > (spawn-via-monitor): new procedure. > (spawn-command): use it. Good catch! I added a test and a copyright line for you (let me know if I got it wrong) and pushed as 18989f2fffa6ecdbd0f9b77834e1a54c9c45ee73. > From 51ee63ace6f3f52eb196c990664cc6b9af3d3683 Mon Sep 17 00:00:00 2001 > From: ulfvonbelow > Date: Sat, 25 Feb 2023 00:46:27 -0600 > Subject: [PATCH 2/3] service: accept fork+exec-command argument list in > monitor. > > Sometimes it's necessary to run startup / shutdown programs as a certain = user, > in a certain directory, with certain environment variables, etc. Shepherd > currently provides a replacement for system* that won't race against the > child process auto-reaper, but this lacks the flexibility Shepherd users = are > used to. > > * modules/shepherd/service.scm (process-monitor): treat command instead as > argument list to fork+exec-command. > (spawn-via-monitor): update to new convention. > (fork+exec+wait-command): new procedure. I=E2=80=99ll take a closer look to this one and report back soon. > From 177592ee9d4b7fc6dcc80e545e8ad615a1d6786c Mon Sep 17 00:00:00 2001 > From: ulfvonbelow > Date: Sat, 25 Feb 2023 00:56:57 -0600 > Subject: [PATCH 3/3] service: add spawn-shell-command replacement for > `system'. > > We already have a replacement for `system*' that avoids racing, but not f= or > `system'. > > * configure.ac (SHELL): new substitution variable. > * modules/shepherd/system.scm.in (%shell-filename): new variable. > * modules/shepherd/service.scm > (spawn-shell-command, real-system): new procedures. > * modules/shepherd.scm (main): replace `system' with `spawn-shell-command= '. Out of curiosity, do you have a need for =E2=80=98system=E2=80=99? I=E2=80= =99m inclined to recommend against its use, in which case this patch is unnecessary. > +(define %shell-filename "@SHELL@") This is the configure-time shell so it will be wrong when cross-compiling. I=E2=80=99d just do: (define %shell (or (getenv "SHELL") "/bin/sh")) Thanks! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 04 17:10:05 2023 Received: (at 61803) by debbugs.gnu.org; 4 Mar 2023 22:10:05 +0000 Received: from localhost ([127.0.0.1]:37950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYa4q-0006et-Cg for submit@debbugs.gnu.org; Sat, 04 Mar 2023 17:10:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pYa4o-0006eG-C4; Sat, 04 Mar 2023 17:10:02 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYa4e-0001l9-7v; Sat, 04 Mar 2023 17:09:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=4qdMlE4qaKwBZuVVTqyIbpfQWN5SXC9h/CQycZ7SvH0=; b=DuAjp2XEyQYftZSDxv2O t3/i6pHoxKrBaOtKtbMdJwDI3g1WcZJ+aItQKqjDINuglcQSk1TF3CMvS+yE4aRtBCTrluU/Nh4ZE 90tQOcjWpfLVD0oEnNZFSe7tNwHUXc+ou7JZ9ErAosLHjuvlNSzpA+yZ725DbRe3dfwWtcfszqrgJ t5sdgz1WLqX8NRiFLuh6S7lADW2Ky+iCRwcq68NGWpwBJ8GZU5DE2eS0kKcU7e7Qai5wc36PeTZC9 Xosk7xwo6rBBRlCbBn9ifo6gCW1n4kfA4MFjDr7SQe79Jn38l7TVRe/g7/+xtA95W3QqtuPousMVZ qxcOn00mNAIw/w==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYa4d-0001Mh-Oh; Sat, 04 Mar 2023 17:09:51 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Ulf Herrman Subject: Re: bug#61803: [PATCH 0/3] [shepherd] improve race-free spawn+wait References: <87cz5x1jr2.fsf@tilde.club> Date: Sat, 04 Mar 2023 23:09:49 +0100 In-Reply-To: <87cz5x1jr2.fsf@tilde.club> (Ulf Herrman's message of "Sat, 25 Feb 2023 16:08:01 -0600") Message-ID: <877cvwp3rm.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61803 Cc: 61803@debbugs.gnu.org, 60106-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Ulf, Ulf Herrman skribis: > From 51ee63ace6f3f52eb196c990664cc6b9af3d3683 Mon Sep 17 00:00:00 2001 > From: ulfvonbelow > Date: Sat, 25 Feb 2023 00:46:27 -0600 > Subject: [PATCH 2/3] service: accept fork+exec-command argument list in > monitor. > > Sometimes it's necessary to run startup / shutdown programs as a certain = user, > in a certain directory, with certain environment variables, etc. Shepherd > currently provides a replacement for system* that won't race against the > child process auto-reaper, but this lacks the flexibility Shepherd users = are > used to. > > * modules/shepherd/service.scm (process-monitor): treat command instead as > argument list to fork+exec-command. > (spawn-via-monitor): update to new convention. > (fork+exec+wait-command): new procedure. On this one I took a similar approach but chose to extend =E2=80=98spawn-command=E2=80=99 instead of introducing a new procedure=E2= =80=94see commit 0f3276a9c3dafbef41b0aab88ba5dda1bb78dc99. Another difference is explicitly listing keyword arguments so that their default values are taken from the caller=E2=80=99s dynamic state and not fr= om that of the process monitoring fiber. This fixes . Let me know what you think! Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 08 23:46:06 2023 Received: (at 61803) by debbugs.gnu.org; 9 Mar 2023 04:46:06 +0000 Received: from localhost ([127.0.0.1]:50633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pa8AF-0002dr-1G for submit@debbugs.gnu.org; Wed, 08 Mar 2023 23:46:06 -0500 Received: from tilde.club ([142.44.150.184]:47708 ident=postfix) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pa7HO-00015g-DO for 61803@debbugs.gnu.org; Wed, 08 Mar 2023 22:49:25 -0500 Received: by tilde.club (Postfix, from userid 5378) id 841CD22310E14; Thu, 9 Mar 2023 03:49:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 tilde.club 841CD22310E14 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tilde.club; s=mail; t=1678333760; bh=ptLuDpN3X/ECugzjXCyRhIPWxPsoXmEZuScz5N4SV44=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=xs2IJJh1eSPYKJe4B8m49ASSBangvpAIjkTTsVXTkoBxN+Z4W06uw3wZixuI7ovwR m+YpQ+D/LZ5XEtHsBnKNvAp7Hh2X10ScEsGzuXebQQPn41WJy7aIgL8Yip4sPAx3Vm I4cc8QZOIlHvtTiuceHfPVTafVJczv36Rl9+Znlg= From: Ulf Herrman To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#61803: [PATCH 0/3] [shepherd] improve race-free spawn+wait References: <87cz5x1jr2.fsf@tilde.club> <87h6v23ike.fsf@gnu.org> Date: Wed, 08 Mar 2023 21:48:54 -0600 In-Reply-To: <87h6v23ike.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Thu, 02 Mar 2023 23:16:33 +0100") Message-ID: <878rg61t5l.fsf@tilde.club> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61803 X-Mailman-Approved-At: Wed, 08 Mar 2023 23:45:48 -0500 Cc: 61803@debbugs.gnu.org, Ulf Herrman X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: >> From 177592ee9d4b7fc6dcc80e545e8ad615a1d6786c Mon Sep 17 00:00:00 2001 >> From: ulfvonbelow >> Date: Sat, 25 Feb 2023 00:56:57 -0600 >> Subject: [PATCH 3/3] service: add spawn-shell-command replacement for >> `system'. >> >> We already have a replacement for `system*' that avoids racing, but not = for >> `system'. >> >> * configure.ac (SHELL): new substitution variable. >> * modules/shepherd/system.scm.in (%shell-filename): new variable. >> * modules/shepherd/service.scm >> (spawn-shell-command, real-system): new procedures. >> * modules/shepherd.scm (main): replace `system' with `spawn-shell-comman= d'. > Out of curiosity, do you have a need for =E2=80=98system=E2=80=99? I don't. > I=E2=80=99m inclined to recommend against its use, in which case this pat= ch is > unnecessary. I tend to agree, but make-system-constructor and make-system-destructor both use it and are documented in the manual, so we should either make them work properly or remove them. >> +(define %shell-filename "@SHELL@") > > This is the configure-time shell so it will be wrong when > cross-compiling. > > I=E2=80=99d just do: > > (define %shell (or (getenv "SHELL") "/bin/sh")) > The rationale behind not taking that straightforward approach was to closely emulate the normal behavior of 'system' on guix, where the shell path used is a hardcoded store path, though since guix's libc is likely the only one where this is anything other than /bin/sh, I suppose it does make a lot more sense to patch it in the guix package definition (or accept the minor behavioral difference) than to try to automagically figure it out at configure-time, which also has the problems you mentioned. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHIBAEBCAAyFiEEn6BUn0yca1D9JsMa1lV76sJM9mgFAmQJVyYUHHN0cmluZXNz QHRpbGRlLmNsdWIACgkQ1lV76sJM9mjyagv+LCgotxnqeNPwMzd6Fj42twBH6FAS jczDRUd03kKnr0colb/1/4U/14E99MhbQhyrtKrjwMxhvNg2CfU4f4Gsj/McrqeG Livn2lvciUB9psr8CXfs6eEhr1yVCb9khlGbEXzNoAjcCINldMIXf/qcMNtIfN5L 9sQC7c44bjnwqXqpLBttbcm6IltCgCOkFmMa5OKqgugWjxbyLV60LyWbXMGs7nVt Uys6U3nDhu2gC8pcMm3Q25xt14KcsRKz4YmTzlK3M+JAkIW63VYMNm0ryqO2a+az XQ+agSHLZSSPIGYMpfKpjKz5m4wQHExAjBM5bX0WedTXdqv5tpFK4ItQve9mYuu0 VFbyEzjztP6N6M+Fs4cmokOyE4hqGzoEFQDIV9l7qFsRWomMBD4AX6LK2LbPbwUU +0IYIBCO9HZhpdueUFO/Cg/MPFby9jVxkvCHecTYyhNhNV3WCCu3G6xEFZE8KoPN yjHr6f6dbgZImihf0cSg3e5u/3XQyDUpjet5 =2DeH -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 11 09:58:07 2023 Received: (at 61803) by debbugs.gnu.org; 11 Mar 2023 14:58:07 +0000 Received: from localhost ([127.0.0.1]:58466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pb0ff-0005CK-8T for submit@debbugs.gnu.org; Sat, 11 Mar 2023 09:58:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pb0fU-0005Bb-Dv for 61803@debbugs.gnu.org; Sat, 11 Mar 2023 09:58:06 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pb0fK-000573-1q; Sat, 11 Mar 2023 09:57:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=43nBCW04w4X/aNuqN6HEN/3Ie9A4qSls3fXwaEJsio4=; b=H9IDo5lr7Vb+6Ix1qfkJ XSVivfVngmCSQxlGIDI8/xcmceTP5XmatWMYlk6GLwLq1fgJMJ4ayK1niArQ4Xcj6zFyK/TvMepTj kg/dVaXOrbOh7N9O8/enRT3DInii7bCdQaIcfeReEVvjFsT9qjZTVGIoPUbvrAwJDavMXLSNa9Sif effZwkhh6Yazui4FuobP3HylwtxwnWug1yNGT5xEGzP1Z9Y47NDh8FaPvdUWNcSvkTm5JMdBsj2xV V3IBFydnjJ6PPaEWtaIwj+UixrnPZP11cX5JvdToNPXdVi8UQy5bSDnuh185LUdZ/PlZmfEktgj63 /93Kl6sdBihW2A==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pb0fJ-0006em-I9; Sat, 11 Mar 2023 09:57:45 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Ulf Herrman Subject: Re: bug#61803: [PATCH 0/3] [shepherd] improve race-free spawn+wait References: <87cz5x1jr2.fsf@tilde.club> <87h6v23ike.fsf@gnu.org> <878rg61t5l.fsf@tilde.club> Date: Sat, 11 Mar 2023 15:57:43 +0100 In-Reply-To: <878rg61t5l.fsf@tilde.club> (Ulf Herrman's message of "Wed, 08 Mar 2023 21:48:54 -0600") Message-ID: <87v8j7wd20.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 61803 Cc: 61803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Ulf, Ulf Herrman skribis: > I tend to agree, but make-system-constructor and make-system-destructor > both use it and are documented in the manual, so we should either make > them work properly or remove them. Yeah, you=E2=80=99re right. So I guess we need to support it for now and s= tart a deprecation cycle so we can eventually remove it. For now, I=E2=80=99ve pushed a simplified version of your patch as 89dd3bb57fa3e3a23cf85385b0788046b7e45170. Let me know if you notice something wrong! Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 11 09:58:14 2023 Received: (at control) by debbugs.gnu.org; 11 Mar 2023 14:58:14 +0000 Received: from localhost ([127.0.0.1]:58470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pb0fl-0005Cd-QN for submit@debbugs.gnu.org; Sat, 11 Mar 2023 09:58:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pb0fh-0005CA-0V for control@debbugs.gnu.org; Sat, 11 Mar 2023 09:58:09 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pb0fb-0005D6-QR for control@debbugs.gnu.org; Sat, 11 Mar 2023 09:58:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:Subject:From:To:Date:in-reply-to: references; bh=roeex2+inb+bwFaHRWN62c5XauC3afIbzal7z4UrroM=; b=W6lo/N80OD4dTK OrhesAmn9vfYvQJsPMPUzObotQHbobr+i+uR93A22EFZ/ritoYDEmG+uXVF0kr1ay5LkjxaeFaWbm QfKkLpNQ6Cu6C41O7OKnK+S/Sf1ZtCYv0SXvwmFgIYlYTD52fk4oTum9L8oR1aZ3s7wU1rmTkLZ08 31biTmeb7A7/VOfRw6BN9pY/tMj7MAgfLbi6WTYc/E+8272zBjPxCX0l1S7qIi/Frm4py1SqFE9Xy FiW9st9Tg6IJ0qmhYciM5bzL3Gsqak/tD7XZ33XZuQ4eNXqAbgIpGfoIx0JRxeW9RQ/wRp7Qj6JAg 5gPFjMldwWD7H/4WU++Q==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pb0fb-0007ZJ-E8 for control@debbugs.gnu.org; Sat, 11 Mar 2023 09:58:03 -0500 Date: Sat, 11 Mar 2023 15:58:02 +0100 Message-Id: <87ttyrwd1h.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #61803 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 61803 quit From unknown Fri Jun 20 18:05:41 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 09 Apr 2023 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator