unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43643: start shepherd when a previous instance was killed by kill -9
@ 2020-09-27  8:00 gfleury
  2020-09-27 14:19 ` Danny Milosavljevic
  2020-09-27 18:09 ` gfleury
  0 siblings, 2 replies; 3+ messages in thread
From: gfleury @ 2020-09-27  8:00 UTC (permalink / raw)
  To: 43643

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

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 #<input-output: socket 16> #(1 "/run/user/1000?") #)

ERROR: In procedure bind:
In procedure bind: Address already in use
---------------------------------------------------------

something like this patch can fix it.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ensure-that-default-socket-file-is-not-present.patch --]
[-- Type: text/x-diff, Size: 928 bytes --]

From 7d16c47bad6fd98cf0838d2fcd62735d846e7bab Mon Sep 17 00:00:00 2001
From: gfleury <gfleury@disroot.org>
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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-27 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27  8:00 bug#43643: start shepherd when a previous instance was killed by kill -9 gfleury
2020-09-27 14:19 ` Danny Milosavljevic
2020-09-27 18:09 ` gfleury

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).