From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0bmW-0008L8-Bd for guix-patches@gnu.org; Mon, 26 Mar 2018 19:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0bie-0004Br-Rx for guix-patches@gnu.org; Mon, 26 Mar 2018 19:44:04 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:47030) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0bie-0004BB-BJ for guix-patches@gnu.org; Mon, 26 Mar 2018 19:40:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f0bid-0004Op-LT for guix-patches@gnu.org; Mon, 26 Mar 2018 19:40:03 -0400 Subject: [bug#30948] [PATCH core-updates] guix: Reap finished child processes in build containers. Resent-Message-ID: References: <87muyvulwt.fsf@zancanaro.id.au> From: Carlo Zancanaro In-reply-to: <87muyvulwt.fsf@zancanaro.id.au> Date: Tue, 27 Mar 2018 10:39:41 +1100 Message-ID: <878tae76f6.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 Okay, it turns out my previous patch was very wrong. I tried to start a build and it broke pretty significantly. I've attached a new patch that at least starts building. My computer takes too long to actually build anything, but I'm slightly more confident that my change won't break everything. --=-=-= 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=20c57b2fe19865afc21fd1fd9a7cad3286b05a9b22 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/guix/derivations.scm b/guix/derivations.scm index da686e89e..27ab3e420 100644 =2D-- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -1201,6 +1201,21 @@ ALLOWED-REFERENCES, DISALLOWED-REFERENCES, LOCAL-BUI= LD?, and SUBSTITUTABLE?." (else drv)))))) inputs)) =20 + ;; The root process in the build container should re= ap + ;; processes that die, so handle SIGCHLD. + (use-modules (ice-9 match)) + (sigaction SIGCHLD + (lambda _ + (let loop () + (match (catch 'system-error + (lambda () + (waitpid WAIT_ANY WNOHANG)) + (lambda args + '(0 . -))) + ((0 . _) #f) + ((pid . _) (loop))))) + SA_NOCLDSTOP) + ,@(if (null? modules) '() ;; Remove our own settings. =2D-=20 2.16.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE1lpncq7JnOkt+LaeqdyPv9awIbwFAlq5hL0ACgkQqdyPv9aw Ibw7AA//fT/jMaBcVfGr2W+AN+nsndZ5kJyFAh+y+IbSah3QFYX4FThNTMn0vxLB Wk2lB84ry+jRk5v8P/SFJSrgf6QkoU50psNwd/rkH9fUjjVfLlSGyV5qMwxybNoj QbT2YL/e0xDt1RNN92wuAOQv8PrsBS2ZLqow2fU9H9tPrEb9SBr8ej1oyeGcLs/z ybJlk1KcXpJ79Er716r7tEJxTyiAWOu/PTwvetfsvohUoSoIMgIofBYYudWVP2xr 1ABOASzEITWO2/0Y+XkoN3J8SZTVWjLssw9aaHLdE+7PD7DkDA/qvlzpbLM48SzK eTsmRxXU8li5Sif6wHZ9Y0snWKs4tS1QbExFXJL2dnKOOpltp6ddsrvFq4SX4lMX dQ8l85KWvJDOjnPJ1VaU5OjNUcAGpcHrLvcZ17ePCwDOiuZNZFA1CBhxD5RbH+0B 1usyMd8PvVUo+H8HGC2cbhlwiuZjn6Id4kgn7j9ozaMaRfbUt8yP++EIt/+8GEvo V3uTNVVNXL8omBIXrZH3zOcznqZE/X5yAswcWINShHiWI9Hm6xspspdJp4bPu8+U hFRaW7+Zf1TFbJkg4aDTxpORzP4WOCkzqXb1Kz6gS1qa2PwqzSdLZGq6h5Ep6xmk 3F312fAFpAP03uOKuwVdtHrsH/e+nfVfKk5b2EIBgze8E5N96TQ= =AsO6 -----END PGP SIGNATURE----- --==-=-=--