diff options
author | Ludovic Courtès <[email protected]> | 2025-02-13 11:12:13 +0100 |
---|---|---|
committer | Ludovic Courtès <[email protected]> | 2025-02-21 15:27:12 +0100 |
commit | e36d6ab24b7f405d191f7bf84f0db949c0ee72c0 (patch) | |
tree | 33c7e368883d3f64de5f0390bca4f4b0a1e18136 /gnu/services/networking.scm | |
parent | 9f77db78e6b48cc0e9aa30ef2a223c309703a18e (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 <[email protected]>
Diffstat (limited to 'gnu/services/networking.scm')
-rw-r--r-- | gnu/services/networking.scm | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index b9a5bef5d8..f7c2471535 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2024 Ludovic Courtès <[email protected]> +;;; Copyright © 2013-2025 Ludovic Courtès <[email protected]> ;;; Copyright © 2015 Mark H Weaver <[email protected]> ;;; Copyright © 2016, 2018, 2020 Efraim Flashner <[email protected]> ;;; Copyright © 2016 John Darrington <[email protected]> @@ -390,18 +390,18 @@ '())) (false-if-exception (delete-file #$pid-file)) - (let ((pid (fork+exec-command - ;; By default dhclient uses a - ;; pre-standardization implementation of - ;; DDNS, which is incompatable with - ;; non-ISC DHCP servers; thus, pass '-I'. - ;; <https://kb.isc.org/docs/aa-01091>. - `(,dhclient "-nw" "-I" - #$(string-append "-" version) - "-pf" ,#$pid-file - ,@config-file-args - ,@ifaces)))) - (and (zero? (cdr (waitpid pid))) + (let ((status (spawn-command + ;; By default dhclient uses a + ;; pre-standardization implementation of + ;; DDNS, which is incompatable with + ;; non-ISC DHCP servers; thus, pass '-I'. + ;; <https://kb.isc.org/docs/aa-01091>. + `(,dhclient "-nw" "-I" + #$(string-append "-" version) + "-pf" ,#$pid-file + ,@config-file-args + ,@ifaces)))) + (and (zero? status) (read-pid-file #$pid-file))))) (stop #~(make-kill-destructor))))))) (package |