unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#58485: [shepherd] Restarting guix-publish fails
@ 2022-10-13  7:51 Lars-Dominik Braun
  2022-10-13  9:28 ` Liliana Marie Prikler
  2022-11-17  8:24 ` Ludovic Courtès
  0 siblings, 2 replies; 15+ messages in thread
From: Lars-Dominik Braun @ 2022-10-13  7:51 UTC (permalink / raw)
  To: 58485; +Cc: Ludovic Courtès

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") #<procedure 7f8173184940 ?> ?)
  1752:10  5 (with-exception-handler _ _ #:unwind? _ # _)
In ice-9/eval.scm:
    619:8  4 (_ #(#(#<directory (guile-user) 7f817318ac80>)))
In ice-9/boot-9.scm:
   260:13  3 (for-each #<procedure restart-service (name)> _)
In gnu/services/herd.scm:
    168:4  2 (invoke-action guix-publish restart () #<procedure 7f81?>)
    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





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

end of thread, other threads:[~2023-06-11 14:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13  7:51 bug#58485: [shepherd] Restarting guix-publish fails Lars-Dominik Braun
2022-10-13  9:28 ` Liliana Marie Prikler
2022-10-13 11:35   ` Lars-Dominik Braun
2022-10-13 13:38     ` Liliana Marie Prikler
2022-10-14  6:18       ` Lars-Dominik Braun
2022-10-14  6:57         ` Liliana Marie Prikler
2022-11-17  8:24 ` Ludovic Courtès
2022-11-17 10:19   ` Ludovic Courtès
2023-02-07  8:39   ` Lars-Dominik Braun
     [not found]   ` <Y+IM4IrO4V05o3V9@zpidnb93>
2023-02-20 10:20     ` Ludovic Courtès
2023-02-20 13:25       ` Lars-Dominik Braun
2023-04-27 21:23         ` Ludovic Courtès
2023-04-28 12:31           ` Lars-Dominik Braun
2023-04-28 13:09           ` bug#58485: [shepherd] EADDRINUSE while restarting ssh-daemon Ludovic Courtès
2023-06-11 14:20             ` Ludovic Courtès

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).