services: nginx: Ensure ‘stop’ is synchronous.

Fixes guix/maintenance#17.

Fixes a bug whereby ‘nginx -s stop’ might return before the main nginx process
has actually stopped, which in turn would lead ‘herd restart nginx’ to hang.

* gnu/services/web.scm (nginx-shepherd-service): Change ‘stop’ to use
‘make-kill-destructor’.

Reported-by: Maxim Cournoyer <maxim@guixotic.coop>
Change-Id: I69e8626aab07f806ddc8b1d09d9f0e052a85cf47
This commit is contained in:
Ludovic Courtès 2025-08-26 11:52:25 +02:00
parent 1c235670d8
commit b377ec079d
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -907,7 +907,12 @@ of index files."
(modules `((ice-9 match) (modules `((ice-9 match)
,@%default-modules)) ,@%default-modules))
(start (nginx-action "-p" run-directory)) (start (nginx-action "-p" run-directory))
(stop (nginx-action "-s" "stop"))
;; Instead of invoking "nginx -s stop", use
;; 'make-kill-destructor', which waits for the main process to
;; actually terminate.
(stop #~(make-kill-destructor))
(actions (actions
(list (list
(shepherd-configuration-action config-file) (shepherd-configuration-action config-file)