From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id UF6+M6DbdGVQIAEAauVa8A:P1 (envelope-from ) for ; Sat, 09 Dec 2023 22:26:56 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id UF6+M6DbdGVQIAEAauVa8A (envelope-from ) for ; Sat, 09 Dec 2023 22:26:56 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tobias.gr header.s=2018 header.b=BEEJIJdw; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1702157216; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=eV+kbvBD97XDR+LH+xsNQfakXShzhhcsfUAKAjcaOrw=; b=d+wMRVhq6+hnBNnyi7BDk8x+cdsA0xAkUsWMdXj5N75A7FlTnzipSd4QCS5Ay1ORrkLtDG ldJIpqYMosHlMFNdmNWxuBwM8r3B+dsRVbdxDqR3QLFL9nchTwpVWXcNobeAqqohrAzkK9 Q3X6iQhHjXsO4Q9paSRDcM5ZSbgEkLuxx4ARO1EFZF/7svQ9sq1c3BZQjl7JgEHNzboFL0 OjI4u3DWG3SJlYFkYp3Enx/nuXkrDrmHYCXQxEMVSVu/fmRZBbApnVN8yZtuZgPfVw9lxq hVnqPREfrK2u7d6WGAcxFzMaF/5i8dx8W08rJvKySF/17YEBUthXlY1QLz+INQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tobias.gr header.s=2018 header.b=BEEJIJdw; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1702157216; a=rsa-sha256; cv=none; b=m4SsyDJMaLBgnr7EdRNwKIAzVy3p8H8Tmns1iJxPKhTG7nY3AOum2/d/uBvNohHKlI7rkU HoJgO2ePMvFnE01PF2tYNFHQwL33HMirQfgLw9yDVgyyKzeitOdwJG4pjgJ5LfSmb/K6Mv /Id02sqpo/5/CR2reIu834bWYmTz7878+VWFjmKcMLAm48w5b4Er2bQ39rXR+82EgRGapi OJYhrk55muSNMdItvtQKE8357LZTwhDkyZeQwK4Am6dZ95najIJE6VdQPzmwFR+rneUIq1 0i7oMFpX+nbFsCffXCtV4QHLXVww4OL9xOfRSwx5v5i0bFQ3bMA6dVxBKBsW5A== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 07A45508E6 for ; Sat, 9 Dec 2023 22:26:56 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rC4qZ-0001Rl-SF; Sat, 09 Dec 2023 16:26:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rC4qY-0001RX-Bz for guix-patches@gnu.org; Sat, 09 Dec 2023 16:26:50 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rC4qW-0005Mm-K5 for guix-patches@gnu.org; Sat, 09 Dec 2023 16:26:49 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rC4qk-0007Jt-9g for guix-patches@gnu.org; Sat, 09 Dec 2023 16:27:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67733] [PATCH v2] daemon: Sacrifice builders on OOM. References: <20231203000032.29995-1-me@tobias.gr> In-Reply-To: <20231203000032.29995-1-me@tobias.gr> Resent-From: Tobias Geerinckx-Rice Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 09 Dec 2023 21:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67733 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67733@debbugs.gnu.org Received: via spool by 67733-submit@debbugs.gnu.org id=B67733.170215721928128 (code B ref 67733); Sat, 09 Dec 2023 21:27:02 +0000 Received: (at 67733) by debbugs.gnu.org; 9 Dec 2023 21:26:59 +0000 Received: from localhost ([127.0.0.1]:49101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rC4qg-0007Jc-QF for submit@debbugs.gnu.org; Sat, 09 Dec 2023 16:26:59 -0500 Received: from tobias.gr ([80.241.217.52]:47658) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rC4qf-0007JT-4V for 67733@debbugs.gnu.org; Sat, 09 Dec 2023 16:26:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=2018; bh=eV+kbvBD97XDR +LH+xsNQfakXShzhhcsfUAKAjcaOrw=; h=date:subject:to:from; d=tobias.gr; b=BEEJIJdwMQew6nJ/25NmQfWK3J4e7WD0Att6dLGQqkMDZhZag5o6SEfl6Ud8ZGmeAUhz 7EFqJmgx3KvAF7kvB0mXqf36qljo6jRnEMJL1pKz0g/S1EQBqPr2BjA2u2oLkIQ6cFXpYb FkX/rhwbLAWLj1kmMpZVJnSfQufqJc/TMSymsLp2b9LRaFSy0s5IePKXHUBBl8/CIJ0ixQ Fs8Ih7kMMG89opc0auYQCwEn8bHBCfusnPNYTZVUJF31+VhYpYZm4CORb3eygtZ+9YfevX 0v4ru/zMXjCN9gipfPRXjCxEI4MnfMHLHk9tQHxkUmC1V9olzo+lpLKz7PiTtSaw== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 8b53d2d2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <67733@debbugs.gnu.org>; Sat, 9 Dec 2023 21:26:40 +0000 (UTC) Date: Sun, 3 Dec 2023 01:00:01 +0100 Message-ID: <20231203000124.30383-1-me@tobias.gr> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Tobias Geerinckx-Rice X-ACL-Warn: , Tobias Geerinckx-Rice via Guix-patches From: Tobias Geerinckx-Rice via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -0.91 X-Spam-Score: -0.91 X-Migadu-Queue-Id: 07A45508E6 X-TUID: MV5u6pAH7owz * nix/libstore/build.cc (DerivationGoal::runChild): Maximise our OOM score adjustment. Change-Id: I418c763b499ca16e1ffe3c6033319112b9744f51 --- v2: Tabs tabs tabs tabs. nix/libstore/build.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc index e8259aa4e8..54555b92d7 100644 --- a/nix/libstore/build.cc +++ b/nix/libstore/build.cc @@ -2154,6 +2154,12 @@ void DerivationGoal::runChild() determinism. */ int cur = personality(0xffffffff); if (cur != -1) personality(cur | ADDR_NO_RANDOMIZE); + + /* Ask the kernel to eagerly kill us & our children if it runs out of + memory, regardless of blame, to preserve ‘real’ user data & state. */ + try { + writeFile("/proc/self/oom_score_adj", "1000"); // 100% + } catch (...) { ignoreException(); } #endif /* Fill in the environment. */ base-commit: e796c68025aca372ff8e16eb0c235155af92f743 -- 2.41.0