GNU bug report logs - #67733
[PATCH] daemon: Sacrifice builders on OOM.

Previous Next

Package: guix-patches;

Reported by: Tobias Geerinckx-Rice <me <at> tobias.gr>

Date: Sat, 9 Dec 2023 21:23:01 UTC

Severity: normal

Tags: patch

Done: Steve George <steve <at> futurile.net>

To reply to this bug, email your comments to 67733 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#67733; Package guix-patches. (Sat, 09 Dec 2023 21:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tobias Geerinckx-Rice <me <at> tobias.gr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 09 Dec 2023 21:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: guix-patches <at> gnu.org
Subject: [PATCH] daemon: Sacrifice builders on OOM.
Date: Sun,  3 Dec 2023 01:00:00 +0100
* nix/libstore/build.cc (DerivationGoal::runChild):
Maximise our OOM score adjustment.

Change-Id: I418c763b499ca16e1ffe3c6033319112b9744f51
---
 nix/libstore/build.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index e8259aa4e8..9241418abc 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. */
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#67733; Package guix-patches. (Sat, 09 Dec 2023 21:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 67733 <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 67733 <at> debbugs.gnu.org
Subject: [PATCH v2] daemon: Sacrifice builders on OOM.
Date: Sun,  3 Dec 2023 01:00:01 +0100
* 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





Information forwarded to guix-patches <at> gnu.org:
bug#67733; Package guix-patches. (Sat, 09 Dec 2023 21:33:02 GMT) Full text and rfc822 format available.

Message #11 received at 67733 <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 67733 <at> debbugs.gnu.org
Subject: [PATCH v3] daemon: Sacrifice builders on OOM.
Date: Sun,  3 Dec 2023 01:00:01 +0100
* nix/libstore/build.cc (DerivationGoal::runChild):
Maximise our OOM score adjustment.

Change-Id: I418c763b499ca16e1ffe3c6033319112b9744f51
---

v3: In my defens, I'm on a fone.

 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





Information forwarded to guix-patches <at> gnu.org:
bug#67733; Package guix-patches. (Sun, 10 Dec 2023 21:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 67733 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: 67733 <at> debbugs.gnu.org
Subject: Re: [bug#67733] [PATCH v3] daemon: Sacrifice builders on OOM.
Date: Sun, 10 Dec 2023 22:51:15 +0100
Hullo!

Tobias Geerinckx-Rice <me <at> tobias.gr> skribis:

> * nix/libstore/build.cc (DerivationGoal::runChild):
> Maximise our OOM score adjustment.
>
> Change-Id: I418c763b499ca16e1ffe3c6033319112b9744f51
> ---
>
> v3: In my defens, I'm on a fone.

Nooo, you’re a hero.

> +	/* 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(); }

Sounds like a good idea.  LGTM!

Ludo’.




bug closed, send any further explanations to 67733 <at> debbugs.gnu.org and Tobias Geerinckx-Rice <me <at> tobias.gr> Request was from Steve George <steve <at> futurile.net> to control <at> debbugs.gnu.org. (Thu, 31 Oct 2024 14:07:02 GMT) Full text and rfc822 format available.

Message sent on to Tobias Geerinckx-Rice <me <at> tobias.gr>:
bug#67733. (Thu, 31 Oct 2024 14:07:02 GMT) Full text and rfc822 format available.

Message #19 received at 67733-submitter <at> debbugs.gnu.org (full text, mbox):

From: Steve George <steve <at> futurile.net>
To: control <at> debbugs.gnu.org
Cc: 67733-submitter <at> debbugs.gnu.org
Subject: closing 67733
Date: Thu, 31 Oct 2024 14:06:30 +0000
close 67733 
# committed in: d993ed43b2bae8717437aa27d9d33fd223a6411f
thanks





This bug report was last modified 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.