all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#30948] [PATCH core-updates] guix: Reap finished child processes in build containers.
@ 2018-03-26 11:16 Carlo Zancanaro
  2018-03-26 23:39 ` Carlo Zancanaro
  2018-03-29 20:07 ` Ludovic Courtès
  0 siblings, 2 replies; 19+ messages in thread
From: Carlo Zancanaro @ 2018-03-26 11:16 UTC (permalink / raw)
  To: 30948


[-- Attachment #1.1: Type: text/plain, Size: 576 bytes --]

When working on the Shepherd, I found that in the build containers 
processes don't get reaped by pid 1. See 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30637#29. This 
caused (and will cause) the Shepherd's tests to fail on some 
systems.

Our guile-builder script should handle SIGCHLD and then use 
waitpid to reap the child processes. Here's my attempt at a patch 
to do that.

I haven't been able to build anything with it because the computer 
I'm currently on is laughably slow. If someone else can check that 
you can still build with it I'd really appreciate it.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-Reap-finished-child-processes-in-build-containe.patch --]
[-- Type: text/x-patch, Size: 1457 bytes --]

From 7c66818570a139fc4e7b11de34d07c76ebdc6bac Mon Sep 17 00:00:00 2001
From: Carlo Zancanaro <carlo@zancanaro.id.au>
Date: Mon, 26 Mar 2018 22:08:26 +1100
Subject: [PATCH] guix: Reap finished child processes in build containers.

* guix/derivations (build-expression->derivation)[prologue]: Handle SIGCHLD
  and reap child processes when they finish.
---
 guix/derivations.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index da686e89e..80787e99e 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1180,6 +1180,17 @@ ALLOWED-REFERENCES, DISALLOWED-REFERENCES, LOCAL-BUILD?, and SUBSTITUTABLE?."
                            (filter module-form? exp))
                           (_ `(,exp)))
 
+                      ;; The root process in the build container should reap
+                      ;; processes that die, so handle SIGCHLD.
+                      (sigaction SIGCHLD
+                        (lambda ()
+                          (let loop ()
+                            (match (waitpid WAIT_ANY WNOHANG)
+                              ((0 . _) #f)
+                              ((pid . _) (loop))
+                              (_ #f))))
+                        SA_NOCLDSTOP)
+
                       (define %output (getenv "out"))
                       (define %outputs
                         (map (lambda (o)
-- 
2.16.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2023-12-30  3:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-26 11:16 [bug#30948] [PATCH core-updates] guix: Reap finished child processes in build containers Carlo Zancanaro
2018-03-26 23:39 ` Carlo Zancanaro
2018-03-29 20:07 ` Ludovic Courtès
2018-03-29 21:15   ` Carlo Zancanaro
2018-03-30  8:16     ` Ludovic Courtès
2018-03-30 11:17       ` Carlo Zancanaro
2018-03-30 15:17         ` Ludovic Courtès
2022-11-24 16:40           ` Maxim Cournoyer
2022-11-24 16:44           ` bug#30948: " Maxim Cournoyer
2022-11-26 15:11             ` Ludovic Courtès
2022-11-27  3:00               ` Maxim Cournoyer
2022-11-28 15:04                 ` Ludovic Courtès
2022-11-28 20:10                   ` Maxim Cournoyer
2022-11-29  2:07                   ` Maxim Cournoyer
2023-12-17 20:23                   ` bug#30948: [PATCH core-updates] build-system/gnu: Turn PID 1 into an “init”-style process by default Ludovic Courtès
2023-12-17 21:46                     ` Maxim Cournoyer
2023-12-18 17:46                       ` bug#30948: [PATCH core-updates] guix: Reap finished child processes in build containers Ludovic Courtès
2023-12-30  3:36                         ` Maxim Cournoyer
2023-12-19 22:56                     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.