all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#67733] [PATCH] daemon: Sacrifice builders on OOM.
@ 2023-12-03  0:00 Tobias Geerinckx-Rice via Guix-patches via
  2023-12-03  0:00 ` [bug#67733] [PATCH v2] " Tobias Geerinckx-Rice via Guix-patches via
  2023-12-03  0:00 ` [bug#67733] [PATCH v3] " Tobias Geerinckx-Rice via Guix-patches via
  0 siblings, 2 replies; 4+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2023-12-03  0:00 UTC (permalink / raw)
  To: 67733

* 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





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

* [bug#67733] [PATCH v2] daemon: Sacrifice builders on OOM.
  2023-12-03  0:00 [bug#67733] [PATCH] daemon: Sacrifice builders on OOM Tobias Geerinckx-Rice via Guix-patches via
@ 2023-12-03  0:00 ` Tobias Geerinckx-Rice via Guix-patches via
  2023-12-03  0:00 ` [bug#67733] [PATCH v3] " Tobias Geerinckx-Rice via Guix-patches via
  1 sibling, 0 replies; 4+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2023-12-03  0:00 UTC (permalink / raw)
  To: 67733

* 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





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

* [bug#67733] [PATCH v3] daemon: Sacrifice builders on OOM.
  2023-12-03  0:00 [bug#67733] [PATCH] daemon: Sacrifice builders on OOM Tobias Geerinckx-Rice via Guix-patches via
  2023-12-03  0:00 ` [bug#67733] [PATCH v2] " Tobias Geerinckx-Rice via Guix-patches via
@ 2023-12-03  0:00 ` Tobias Geerinckx-Rice via Guix-patches via
  2023-12-10 21:51   ` Ludovic Courtès
  1 sibling, 1 reply; 4+ messages in thread
From: Tobias Geerinckx-Rice via Guix-patches via @ 2023-12-03  0:00 UTC (permalink / raw)
  To: 67733

* 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





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

* [bug#67733] [PATCH v3] daemon: Sacrifice builders on OOM.
  2023-12-03  0:00 ` [bug#67733] [PATCH v3] " Tobias Geerinckx-Rice via Guix-patches via
@ 2023-12-10 21:51   ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2023-12-10 21:51 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: 67733

Hullo!

Tobias Geerinckx-Rice <me@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’.




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

end of thread, other threads:[~2023-12-10 21:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-03  0:00 [bug#67733] [PATCH] daemon: Sacrifice builders on OOM Tobias Geerinckx-Rice via Guix-patches via
2023-12-03  0:00 ` [bug#67733] [PATCH v2] " Tobias Geerinckx-Rice via Guix-patches via
2023-12-03  0:00 ` [bug#67733] [PATCH v3] " Tobias Geerinckx-Rice via Guix-patches via
2023-12-10 21:51   ` 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.