GNU bug report logs - #50327
[PATCH 0/2] Improved ‘free disk space’ message + a question

Previous Next

Package: guix-patches;

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

Date: Wed, 1 Sep 2021 19:24:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 50327 AT debbugs.gnu.org.

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#50327; Package guix-patches. (Wed, 01 Sep 2021 19:24: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. (Wed, 01 Sep 2021 19:24: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 0/2] Improved ‘free disk space’ message + a question
Date: Wed, 01 Sep 2021 21:05:42 +0200
[Message part 1 (text/plain, inline)]
Guix,

This improves the warning given when free space looks sus.

From:

 note: build failure may have been caused by lack of free disk 
 space

to:

 note: only 0.01 MiB available in ‘/gnu/store’
 note: only 5.00 MiB available in ‘/tmp/guix-build-foo.drv-0’
 note: build failure may have been caused by lack of free disk 
 space

It also raises the warning threshold from 8 to 64 MiB, which is a 
much prettier arbitrary integer.

Question: shouldn't all of nix/ have licence headers added too? 
As it stands, there are two very lonely ones in 
nix/libstore/builtins.{cc,hh} and that's it.

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50327; Package guix-patches. (Wed, 01 Sep 2021 19:26:01 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 50327 <at> debbugs.gnu.org
Subject: [PATCH 1/2] daemon: Print which disk(s) are how full.
Date: Wed,  1 Sep 2021 21:25:44 +0200
* nix/libstore/build.cc (pathFull): New function.
(DerivationGoal::buildDone): Use it.
---
 nix/libstore/build.cc | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 5697ae5a43..963cddb98b 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -1297,6 +1297,25 @@ void replaceValidPath(const Path & storePath, const Path tmpPath)
         deletePath(oldPath);
 }
 
+static bool pathFull(Path path)
+{
+#if HAVE_STATVFS
+    unsigned long long required = 8ULL * 1024 * 1024; // FIXME: make configurable
+    struct statvfs st;
+
+    if (statvfs(path.c_str(), &st) == 0) {
+        unsigned long long free = (unsigned long long) st.f_bavail * st.f_bsize;
+        if (free < required) {
+            printMsg(lvlError, format("note: only %1$.2f MiB available in ‘%2%’")
+                                      % (free / (1024.0 * 1024.0)) % path);
+            return true;
+        }
+    }
+#endif
+
+    return false;
+}
+
 
 MakeError(NotDeterministic, BuildError)
 
@@ -1355,16 +1374,10 @@ void DerivationGoal::buildDone()
                of knowing whether the build actually got an ENOSPC.
                So instead, check if the disk is (nearly) full now.  If
                so, we don't mark this build as a permanent failure. */
-#if HAVE_STATVFS
-            unsigned long long required = 8ULL * 1024 * 1024; // FIXME: make configurable
-            struct statvfs st;
-            if (statvfs(settings.nixStore.c_str(), &st) == 0 &&
-                (unsigned long long) st.f_bavail * st.f_bsize < required)
+            if (pathFull(settings.nixStore))
                 diskFull = true;
-            if (statvfs(tmpDir.c_str(), &st) == 0 &&
-                (unsigned long long) st.f_bavail * st.f_bsize < required)
+            if (pathFull(tmpDir))
                 diskFull = true;
-#endif
 
             deleteTmpDir(false);
 
-- 
2.32.0





Information forwarded to guix-patches <at> gnu.org:
bug#50327; Package guix-patches. (Wed, 01 Sep 2021 19:26:02 GMT) Full text and rfc822 format available.

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

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 50327 <at> debbugs.gnu.org
Subject: [PATCH 2/2] daemon: Suspect low disk space sooner.
Date: Wed,  1 Sep 2021 21:25:45 +0200
* nix/libstore/build.cc (pathFull): Bump the required free space up to
a more 2021 amount of 64 MiB.
---
 nix/libstore/build.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 963cddb98b..f62704a107 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -1300,7 +1300,7 @@ void replaceValidPath(const Path & storePath, const Path tmpPath)
 static bool pathFull(Path path)
 {
 #if HAVE_STATVFS
-    unsigned long long required = 8ULL * 1024 * 1024; // FIXME: make configurable
+    unsigned long long required = 64ULL * 1024 * 1024; // FIXME: make configurable
     struct statvfs st;
 
     if (statvfs(path.c_str(), &st) == 0) {
-- 
2.32.0





Information forwarded to guix-patches <at> gnu.org:
bug#50327; Package guix-patches. (Sat, 18 Sep 2021 09:54:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: 50327 <at> debbugs.gnu.org
Subject: Re: bug#50327: [PATCH 0/2] Improved ‘free disk
 space’ message + a question
Date: Sat, 18 Sep 2021 11:53:21 +0200
Tobias Geerinckx-Rice <me <at> tobias.gr> skribis:

> * nix/libstore/build.cc (pathFull): New function.
> (DerivationGoal::buildDone): Use it.

I’d call it ‘directoryFull’ or ‘partitionFull’.  Otherwise LGTM!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#50327; Package guix-patches. (Sat, 18 Sep 2021 09:56:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tobias Geerinckx-Rice <me <at> tobias.gr>
Cc: 50327 <at> debbugs.gnu.org
Subject: Re: bug#50327: [PATCH 0/2] Improved ‘free disk
 space’ message + a question
Date: Sat, 18 Sep 2021 11:55:06 +0200
Hi,

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

> This improves the warning given when free space looks sus.
>
> From:
>
>  note: build failure may have been caused by lack of free disk   space
>
> to:
>
>  note: only 0.01 MiB available in ‘/gnu/store’
>  note: only 5.00 MiB available in ‘/tmp/guix-build-foo.drv-0’
>  note: build failure may have been caused by lack of free disk   space
>
> It also raises the warning threshold from 8 to 64 MiB, which is a much
> prettier arbitrary integer.

LGTM.  :-)

Eventually we should i18n messages coming from the daemon.

> Question: shouldn't all of nix/ have licence headers added too? As it
> stands, there are two very lonely ones in
> nix/libstore/builtins.{cc,hh} and that's it.

Yeah well, they were taken as-is from Nix.  I wouldn’t bother,
especially since we wouldn’t what copyright holders to list in there.

Thanks!

Ludo’.




This bug report was last modified 2 years and 192 days ago.

Previous Next


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