From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0Q7e-0002Ca-RQ for guix-patches@gnu.org; Mon, 26 Mar 2018 07:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0Q7b-0004cl-LS for guix-patches@gnu.org; Mon, 26 Mar 2018 07:17:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:45771) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0Q7b-0004cb-FR for guix-patches@gnu.org; Mon, 26 Mar 2018 07:17:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f0Q7b-0005xY-7I for guix-patches@gnu.org; Mon, 26 Mar 2018 07:17:03 -0400 Subject: [bug#30948] [PATCH core-updates] guix: Reap finished child processes in build containers. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0Q7O-0002Ah-5V for guix-patches@gnu.org; Mon, 26 Mar 2018 07:16:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0Q7K-0003tJ-Vz for guix-patches@gnu.org; Mon, 26 Mar 2018 07:16:50 -0400 Received: from mail-pl0-x22b.google.com ([2607:f8b0:400e:c01::22b]:35851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0Q7K-0003rU-Oo for guix-patches@gnu.org; Mon, 26 Mar 2018 07:16:46 -0400 Received: by mail-pl0-x22b.google.com with SMTP id 91-v6so3919942pld.3 for ; Mon, 26 Mar 2018 04:16:46 -0700 (PDT) Received: from pidgey (210-1-202-160-cpe.spintel.net.au. [210.1.202.160]) by smtp.gmail.com with ESMTPSA id t1sm25792799pgs.47.2018.03.26.04.16.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Mar 2018 04:16:44 -0700 (PDT) From: Carlo Zancanaro Date: Mon, 26 Mar 2018 22:16:34 +1100 Message-ID: <87muyvulwt.fsf@zancanaro.id.au> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30948@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; format=flowed 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-guix-Reap-finished-child-processes-in-build-containe.patch Content-Transfer-Encoding: quoted-printable From=207c66818570a139fc4e7b11de34d07c76ebdc6bac Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro 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. =2D-- guix/derivations.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guix/derivations.scm b/guix/derivations.scm index da686e89e..80787e99e 100644 =2D-- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -1180,6 +1180,17 @@ ALLOWED-REFERENCES, DISALLOWED-REFERENCES, LOCAL-BUI= LD?, and SUBSTITUTABLE?." (filter module-form? exp)) (_ `(,exp))) =20 + ;; The root process in the build container should re= ap + ;; 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) =2D-=20 2.16.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE1lpncq7JnOkt+LaeqdyPv9awIbwFAlq41pIACgkQqdyPv9aw IbwkIBAAsY1CkKoTi0SFmbjGNXXx+PQQmvKBYn94UCRIl6VdhAFiShvNqo0wlDn3 EaRBhyJfC6ZPVTBGhJkdKY1Ar8xiL/9XYE/GpWKzCpITaccTpS1PwLO6A5dmXwUp 5jhhVOfVT1cQb7jSEWlDzee2gcnMUEWwoxM259/tJX3bJeYROnuhfQwZ4PFqBNWq 8njF6cdPVKh059A0Lvp4VUas7HnskHosdzoRzAsFjiwuQMtXX4eO4Vpb1fUsNocA 90JrgJZayu0PfvF3BG8qbkQJixSsgkbBB478L3kk/XUJJsjDCEAA0JYyXPEAWzE7 tmC6DQeZvxl9N7gVYFLk0gWdXXaFWwPieLYR7CvQwk+r9s9bY5b0/904cdx6ZcbY UARtItvXJM3raYuFdG69Dtw/xkj906ljRr+USTcB5kBgrl6oZWh27bVKNVVefdOs TNUFjx7gRUvuFPU6N5foxoJ5+STP4DEg75zqYleLVHhJ/kX7TprviA+aOik+uiN3 /C/WpoWPBxvb++2TYD0VML97OHZa8MML9DswhZvchY2PHHkFfmCrJAYjTj/gHje+ FfRODwEj+EiqTNRnATyFFKzcIRPQkpWyytPbk6T/tq5HonzfD1bmTDTeZY7A4Orh 5gC3Z711PvfLe+N/9JZHBAwSel8sFHyrGw8cv161vxtn2llQlSY= =XRYr -----END PGP SIGNATURE----- --==-=-=--