From unknown Sat Jun 21 10:45:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43643: start shepherd when a previous instance was killed by kill -9 Resent-From: gfleury Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 27 Sep 2020 08:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43643 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 43643@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.160119362614019 (code B ref -1); Sun, 27 Sep 2020 08:01:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Sep 2020 08:00:26 +0000 Received: from localhost ([127.0.0.1]:48259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMRbd-0003e3-Oi for submit@debbugs.gnu.org; Sun, 27 Sep 2020 04:00:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:42292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMRba-0003du-FF for submit@debbugs.gnu.org; Sun, 27 Sep 2020 04:00:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMRba-0002sE-4o for bug-guix@gnu.org; Sun, 27 Sep 2020 04:00:22 -0400 Received: from knopi.disroot.org ([178.21.23.139]:60598) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMRbX-0003ga-Oj for bug-guix@gnu.org; Sun, 27 Sep 2020 04:00:21 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 007B151B70 for ; Sun, 27 Sep 2020 10:00:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aIS-lFdWaRH1 for ; Sun, 27 Sep 2020 10:00:14 +0200 (CEST) From: gfleury DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1601193614; bh=1/z8aHvQMs1gJqmGrcFc9IQzhv/aLpv9VnFuvdfOUJg=; h=From:To:Subject:Date; b=OysCx/eGgDpMg5xEyzdKxtWP/7JE7p1LVTyXIZjEctZHLolh3W8bt0UdJlJ7Z1Osd qebd8pRGtVGpFJOsCaWUxIqsRYxJ++FiU+izl0MO/zBttN+hpOM/byQipl5bhlEFSJ nJ0sJtZxRphgtFPxBAMPw/dJfPeyUZUwmrPpljDXB5tlsqnXkBU4aQavucnd/prd4S a4aaFmMq3yyxOHxVlgSAzJoIV9VAB8K8BQHWeSDaY0w6uLdgCk4iv52yko3ZcoOyaQ bUKQA7ioUJAkuUXp/65wyaVVUKHnzt+Z35ju11IQN9OwoOT7QkB/2z1509Dy/JfhCN /K0vjivpl+14g== Date: Sun, 27 Sep 2020 10:00:03 +0200 Message-ID: <87k0wfejjw.fsf@disroot.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=178.21.23.139; envelope-from=gfleury@disroot.org; helo=knopi.disroot.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/27 04:00:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) 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: text/plain Hi, when killing shepherd i.e `pkill -9 shepherd` it left behind `default-socket-file` and when restarted whithout remove the socket like --------------------------------------------------------- rm /var/run/user/1000/shepherd/socket --------------------------------------------------------- it throws a error: --------------------------------------------------------- 3 (primitive-load "/home/gfleury/prod/shepherd/./shepherd") In shepherd.scm: 56:14 2 (main . _) 49:6 1 (open-server-socket _) In unknown file: 0 (bind # #(1 "/run/user/1000?") #) ERROR: In procedure bind: In procedure bind: Address already in use --------------------------------------------------------- something like this patch can fix it. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ensure-that-default-socket-file-is-not-present.patch >From 7d16c47bad6fd98cf0838d2fcd62735d846e7bab Mon Sep 17 00:00:00 2001 From: gfleury Date: Sun, 27 Sep 2020 09:29:37 +0200 Subject: [PATCH] ensure that `default-socket-file` is not present. * modules/shepherd.scm(main): remove a possible `default-socket-file` left by a previous instance. --- modules/shepherd.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/shepherd.scm b/modules/shepherd.scm index 9f80f62..d18567e 100644 --- a/modules/shepherd.scm +++ b/modules/shepherd.scm @@ -147,7 +147,10 @@ already ~a threads running, disabling 'signalfd' support") (initialize-cli) (let ((config-file #f) - (socket-file default-socket-file) + (socket-file + (begin + (false-if-exception (delete-file default-socket-file)) + default-socket-file)) (pid-file #f) (secure #t) (logfile #f)) -- 2.28.0 --=-=-=-- From unknown Sat Jun 21 10:45:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43643: start shepherd when a previous instance was killed by kill -9 Resent-From: Danny Milosavljevic Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 27 Sep 2020 14:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43643 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: gfleury Cc: 43643@debbugs.gnu.org Received: via spool by 43643-submit@debbugs.gnu.org id=B43643.160121637719764 (code B ref 43643); Sun, 27 Sep 2020 14:20:02 +0000 Received: (at 43643) by debbugs.gnu.org; 27 Sep 2020 14:19:37 +0000 Received: from localhost ([127.0.0.1]:50099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMXWa-00058i-Tm for submit@debbugs.gnu.org; Sun, 27 Sep 2020 10:19:37 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:38552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMXWY-00058Z-QX for 43643@debbugs.gnu.org; Sun, 27 Sep 2020 10:19:35 -0400 Received: from localhost (80-110-126-103.cgn.dynamic.surfer.at [80.110.126.103]) by dd26836.kasserver.com (Postfix) with ESMTPSA id 5A3EA33681E5; Sun, 27 Sep 2020 16:19:33 +0200 (CEST) Date: Sun, 27 Sep 2020 16:19:06 +0200 From: Danny Milosavljevic Message-ID: <20200927161906.399fe259@scratchpost.org> In-Reply-To: <87k0wfejjw.fsf@disroot.org> References: <87k0wfejjw.fsf@disroot.org> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/0noLJoh7SFr=l1pg4veMw3B"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Spam-Score: -0.7 (/) 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.7 (-) --Sig_/0noLJoh7SFr=l1pg4veMw3B Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello, On Sun, 27 Sep 2020 10:00:03 +0200 gfleury wrote: > it throws a error: > --------------------------------------------------------- > 3 (primitive-load "/home/gfleury/prod/shepherd/./shepherd") > In shepherd.scm: > 56:14 2 (main . _) > 49:6 1 (open-server-socket _) > In unknown file: > 0 (bind # #(1 "/run/user/1000?") #) >=20 > ERROR: In procedure bind: > In procedure bind: Address already in use > --------------------------------------------------------- >=20 > something like this patch can fix it. Please don't do it that way. Shepherd has to be able to ascertain that it is not running yet before starting yet another instance in parallel. I don't like PID and socket files either--but it's just what we have available. Maybe find out who is at the other side of the socket (connect and then use getpeername on the socket or something ? maybe even just trying to connect fails, which would be good for this). I think UNIX domain sockets are made in a way that it doesn't matter whether the server or the client connects first, so even that would probably not be reliable. So maybe just live with having to remove the socket file yourself. I'm open to other suggestions that are safe that accomplish the same goal. --Sig_/0noLJoh7SFr=l1pg4veMw3B Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl9wn1oACgkQ5xo1VCww uqXoCwgAoMcxwXRxKGV1diFf7Ii5eJ7vz8PnZbVFaPpCcGHPlF6v7JuYJUOnn/L0 wBvXIbZhefMXdlEk6pQz8RrLvT9A1HFSyPBSCB1mVHw7ln0xJaxVKa9mPeALh4X/ m1voIDSPSC6iAMFgXAUai7Q8DDO9HnGYSWZfJw2icTtKGJ5b7VmwosGLUhZrIDR9 jCH0duwxRjZppkppkkDgXpVYAqs4WVq47jzUr1C0xA0u0iAkVP9tEYrd7MhFQG9S pjlkOa+4L/ndFDcGwEQX+phF+hL5i+eFjD/OyszVsGJuw9xiGmiAvhAGaYbiLVjp bj+K0C2w791Mn18yDPwP3w/zkmOhWQ== =Cc66 -----END PGP SIGNATURE----- --Sig_/0noLJoh7SFr=l1pg4veMw3B-- From unknown Sat Jun 21 10:45:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#43643: start shepherd when a previous instance was killed by kill -9 Resent-From: gfleury@disroot.org Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 27 Sep 2020 18:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43643 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: "Danny Milosavljevic" Cc: 43643@debbugs.gnu.org Received: via spool by 43643-submit@debbugs.gnu.org id=B43643.1601230166853 (code B ref 43643); Sun, 27 Sep 2020 18:10:02 +0000 Received: (at 43643) by debbugs.gnu.org; 27 Sep 2020 18:09:26 +0000 Received: from localhost ([127.0.0.1]:50392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMb70-0000Dh-JQ for submit@debbugs.gnu.org; Sun, 27 Sep 2020 14:09:26 -0400 Received: from knopi.disroot.org ([178.21.23.139]:52100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMb6y-0000DY-2x for 43643@debbugs.gnu.org; Sun, 27 Sep 2020 14:09:25 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id A0A2D529AB; Sun, 27 Sep 2020 20:09:22 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YZrsqQhCLFvh; Sun, 27 Sep 2020 20:09:21 +0200 (CEST) Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1601230161; bh=z2/voU6HtbHfCIOUQAU6P+ihJsofxLCQsfe+Nri0SgY=; h=Date:From:Subject:To:Cc:In-Reply-To:References; b=ZW2LbvNIXemwOM1+8LAEkK80o8Zcsxjv/ElWcn5gfretrwxTazWdCZE75zuheP7hq iqruqXYvjAKFQvKpLiq1aJq7bZkbseyVh5Mknn72QPeh5g19+EPuIraahBVzTw9SRv z8jXLkaSzH85k+eS9PLH7Ufl9nzTth3NRtmv0u2nPy3lYb4VXD3k9lFIlw+Ng5CxKO o2/D4eVLy+onKfafXQPQWXd55hKZEux01NEV9Bfv40ebueHI3sHXWSMYhSgCLOVett Qfl2KODP1dSbelFTnwAWE5B29wZlmVigdWtQnwbDJeki/1gd9xyucAw0CZVicneXUC BDxlHm509m8EQ== Date: Sun, 27 Sep 2020 18:09:21 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: gfleury@disroot.org Message-ID: In-Reply-To: <20200927161906.399fe259@scratchpost.org> References: <20200927161906.399fe259@scratchpost.org> <87k0wfejjw.fsf@disroot.org> X-Spam-Score: -0.0 (/) 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 (-) hello,=0A=0A27 septembre 2020 16:29 "Danny Milosavljevic" a =C3=A9crit:=0A=0A> Hello,=0A> =0A> On Sun, 27 Sep 2020 10:00:= 03 +0200=0A> gfleury wrote:=0A> =0A>> it throws a e= rror:=0A>> ---------------------------------------------------------=0A>>= 3 (primitive-load "/home/gfleury/prod/shepherd/./shepherd")=0A>> In shep= herd.scm:=0A>> 56:14 2 (main . _)=0A>> 49:6 1 (open-server-socket _)=0A>>= In unknown file:=0A>> 0 (bind # #(1 "/run/user/= 1000?") #)=0A>> =0A>> ERROR: In procedure bind:=0A>> In procedure bind: A= ddress already in use=0A>> ----------------------------------------------= -----------=0A>> =0A>> something like this patch can fix it.=0A> =0A> Ple= ase don't do it that way.=0A> =0A> Shepherd has to be able to ascertain t= hat it is not running yet before=0A> starting yet another instance in par= allel.=0A> =0Ai missed that part.=0A=0A> I don't like PID and socket file= s either--but it's just what we have=0A> available.=0A> =0A> Maybe find o= ut who is at the other side of the socket=0A> (connect and then use getpe= ername on the socket or something ?=0A> maybe even just trying to connect= fails, which would be good for this).=0A> =0A> I think UNIX domain socke= ts are made in a way that it doesn't matter=0A> whether the server or the= client connects first, so even that would=0A> probably not be reliable.= =0A> =0A> So maybe just live with having to remove the socket file yourse= lf.=0A> =0A> I'm open to other suggestions that are safe that accomplish = the same goal.=0A=0Ayes a better solution is needed.