summaryrefslogtreecommitdiff
path: root/gnu/services/databases.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-02-13 11:12:13 +0100
committerLudovic Courtès <ludo@gnu.org>2025-02-21 15:27:12 +0100
commite36d6ab24b7f405d191f7bf84f0db949c0ee72c0 (patch)
tree33c7e368883d3f64de5f0390bca4f4b0a1e18136 /gnu/services/databases.scm
parent9f77db78e6b48cc0e9aa30ef2a223c309703a18e (diff)
services: Use ‘spawn-command’ instead of ‘fork’ + ‘waitpid’.
Fixes <https://issues.guix.gnu.org/76315>. This is more concise and more robust: these ‘waitpid’ calls would compete with those made by shepherd’s event loop upon SIGCHLD, and they could hang forever, as illustrated with ‘dhcp-client-service-type’ in <https://issues.guix.gnu.org/76315>. * gnu/services/databases.scm (postgresql-role-shepherd-service): Use ‘spawn-command’ instead of ‘fork+exec-command’ followed by ‘waitpid’. * gnu/services/networking.scm (dhcp-client-shepherd-service): Change ‘start’ to use ‘spawn-command’ instead of ‘fork+exec-command’ and * gnu/services/web.scm (patchwork-django-admin-gexp): Use ‘spawn-command’ instead of ‘primitive-fork’ + ‘waitpid’. Change-Id: I449290bfa46f8600e6ccdb5a6da990ad0cb7948c Reported-by: Tomas Volf <~@wolfsden.cz>
Diffstat (limited to 'gnu/services/databases.scm')
-rw-r--r--gnu/services/databases.scm16
1 files changed, 9 insertions, 7 deletions
diff --git a/gnu/services/databases.scm b/gnu/services/databases.scm
index e8a4acc996d..6530c6f0a12 100644
--- a/gnu/services/databases.scm
+++ b/gnu/services/databases.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 David Thompson <davet@gnu.org>
-;;; Copyright © 2015-2016, 2022-2023 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015-2016, 2022-2023, 2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
@@ -448,12 +448,14 @@ rolname = '" ,name "')) as not_exists;\n"
(one-shot? #t)
(start
#~(lambda args
- (let ((pid (fork+exec-command
- #$(postgresql-create-roles config)
- #:user "postgres"
- #:group "postgres"
- #:log-file #$log)))
- (zero? (cdr (waitpid pid))))))
+ (zero? (spawn-command
+ #$(postgresql-create-roles config)
+ #:user "postgres"
+ #:group "postgres"
+ ;; XXX: As of Shepherd 1.0.2, #:log-file is not
+ ;; supported.
+ ;; #:log-file #$log
+ ))))
(documentation "Create PostgreSQL roles.")))))
(define postgresql-role-service-type