all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
@ 2022-11-06 13:55 Christopher Baines
  2022-11-07 17:37 ` Christopher Baines
  2022-11-11 21:57 ` Ludovic Courtès
  0 siblings, 2 replies; 11+ messages in thread
From: Christopher Baines @ 2022-11-06 13:55 UTC (permalink / raw)
  To: 59078

Currently, if you attempt to run the derivation checker on all packages, the
Guile process will run out of memory. I think a contributing factor to this is
that the checker forces an inefficient order when you want to generate
derivations for all the supported systems of each package, constantly
switching system then package.

This problem also impacts the Guix Data Service, since it tries to run the
derivation checker for all packages.

The changes in this commit to split the derivation lint checker in to several,
one for each system, means that you can now treat each system separately,
which should be better for caching purposes.

If it's desirable to keep some notion of checking all supported systems for a
single package, I think lint checker groups could be added, so that you could
ask for the "derivation" checker, and this would run all the derivation
checkers.

* guix/lint.scm (check-derivation): Adapt to make-check-derivation-for-system.
(%derivation-checkers): New variable.
(%local-checkers): Include all %derivation-checkers.
* doc/guix.texi (Invoking guix lint): Update.
---
 doc/guix.texi |   4 +-
 guix/lint.scm | 139 +++++++++++++++++++++++++++++---------------------
 2 files changed, 83 insertions(+), 60 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 7806b21a0f..8d4989a60c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14422,9 +14422,9 @@ Parse the @code{source} URL to determine if a tarball from GitHub is
 autogenerated or if it is a release tarball.  Unfortunately GitHub's
 autogenerated tarballs are sometimes regenerated.
 
-@item derivation
+@item derivation/SYSTEM
 Check that the derivation of the given packages can be successfully
-computed for all the supported systems (@pxref{Derivations}).
+computed for the specified system (@pxref{Derivations}).
 
 @item profile-collisions
 Check whether installing the given packages in a profile would lead to
diff --git a/guix/lint.scm b/guix/lint.scm
index 8e3976171f..f692856f42 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -52,6 +52,7 @@ (define-module (guix lint)
   #:use-module (guix memoization)
   #:use-module (guix profiles)
   #:use-module (guix monads)
+  #:use-module (guix platform)
   #:use-module (guix scripts)
   #:use-module ((guix ui) #:select (texi->plain-text fill-paragraph))
   #:use-module (guix gnu-maintenance)
@@ -98,7 +99,6 @@ (define-module (guix lint)
             check-patch-file-names
             check-patch-headers
             check-synopsis-style
-            check-derivation
             check-home-page
             check-name
             check-source
@@ -116,6 +116,8 @@ (define-module (guix lint)
             check-haskell-stackage
             check-tests-true
 
+            make-check-derivation-for-system
+
             lint-warning
             lint-warning?
             lint-warning-package
@@ -1369,56 +1371,6 @@ (define (check-phases-deltas deltas)
     (append-map check-phases-delta deltas))
   (find-phase-deltas package check-phases-deltas))
 
-(define* (check-derivation package #:key store)
-  "Emit a warning if we fail to compile PACKAGE to a derivation."
-  (define (try store system)
-    (guard (c ((store-protocol-error? c)
-               (make-warning package
-                             (G_ "failed to create ~a derivation: ~a")
-                             (list system
-                                   (store-protocol-error-message c))))
-              ((exception-with-kind-and-args? c)
-               (make-warning package
-                             (G_ "failed to create ~a derivation: ~s")
-                             (list system
-                                   (cons (exception-kind c)
-                                         (exception-args c)))))
-              ((message-condition? c)
-               (make-warning package
-                             (G_ "failed to create ~a derivation: ~a")
-                             (list system
-                                   (condition-message c))))
-              ((formatted-message? c)
-               (let ((str (apply format #f
-                                 (formatted-message-string c)
-                                 (formatted-message-arguments c))))
-                 (make-warning package
-                               (G_ "failed to create ~a derivation: ~a")
-                               (list system str))))
-              (else
-               (make-warning package
-                             (G_ "failed to create ~a derivation: ~a")
-                             (list system c))))
-      (parameterize ((%graft? #f))
-        (package-derivation store package system #:graft? #f)
-
-        ;; If there's a replacement, make sure we can compute its
-        ;; derivation.
-        (match (package-replacement package)
-          (#f #t)
-          (replacement
-           (package-derivation store replacement system
-                               #:graft? #f))))))
-
-  (define (check-with-store store)
-    (filter lint-warning?
-            (map (cut try store <>) (package-supported-systems package))))
-
-  ;; For backwards compatability, don't rely on store being set
-  (or (and=> store check-with-store)
-      (with-store store
-        (check-with-store store))))
-
 (define* (check-profile-collisions package #:key store)
   "Check for collisions that would occur when installing PACKAGE as a result
 of the propagated inputs it pulls in."
@@ -1843,13 +1795,88 @@ (define (check-formatting package)
                                        (G_ "source file not found"))))))))
         '())))
 
+(define (make-check-derivation-for-system system)
+  (define (try package proc)
+    (guard (c ((store-protocol-error? c)
+               (make-warning package
+                             (G_ "failed to create ~a derivation: ~a")
+                             (list system
+                                   (store-protocol-error-message c))))
+              ((exception-with-kind-and-args? c)
+               (make-warning package
+                             (G_ "failed to create ~a derivation: ~s")
+                             (list system
+                                   (cons (exception-kind c)
+                                         (exception-args c)))))
+              ((message-condition? c)
+               (make-warning package
+                             (G_ "failed to create ~a derivation: ~a")
+                             (list system
+                                   (condition-message c))))
+              ((formatted-message? c)
+               (let ((str (apply format #f
+                                 (formatted-message-string c)
+                                 (formatted-message-arguments c))))
+                 (make-warning package
+                               (G_ "failed to create ~a derivation: ~a")
+                               (list system str))))
+              (else
+               (make-warning package
+                             (G_ "failed to create ~a derivation: ~a")
+                             (list system c))))
+      (proc)))
+
+
+
+  (lambda* (package #:key store)
+    "Emit a warning if we fail to compile PACKAGE to a derivation."
+
+    (define (check-with-store store)
+      (if (member system (package-supported-systems package))
+          (filter
+           lint-warning?
+           (map (cut try package <>)
+                (list
+                 (lambda ()
+                   (parameterize ((%graft? #f))
+                     (package-derivation store package system #:graft? #f)))
+                 (lambda ()
+                   ;; If there's a replacement, make sure we can compute its
+                   ;; derivation.
+                   (match (package-replacement package)
+                     (#f #t)
+                     (replacement
+                      (parameterize ((%graft? #f))
+                        (package-derivation store replacement system
+                                            #:graft? #f))))))))
+          '()))
+
+    ;; For backwards compatability, don't rely on store being set
+    (or (and=> store check-with-store)
+        (with-store store
+          (check-with-store store)))))
+
 \f
 ;;;
 ;;; List of checkers.
 ;;;
 
+(define %derivation-checkers
+  (map (lambda (system)
+         (lint-checker
+          (name (string->symbol
+                 (simple-format #f "derivation/~A" system)))
+          (description
+           (simple-format
+            #f
+            "Report failure to compile a package to a derivation for ~A"
+            system))
+          (check (make-check-derivation-for-system system))
+          (requires-store? #t)))
+       (systems)))
+
 (define %local-checkers
-  (list
+  (cons*
    (lint-checker
      (name        'name)
      (description "Validate package names")
@@ -1901,11 +1928,6 @@ (define %local-checkers
      (name        'source-unstable-tarball)
      (description "Check for autogenerated tarballs")
      (check       check-source-unstable-tarball))
-   (lint-checker
-     (name            'derivation)
-     (description     "Report failure to compile a package to a derivation")
-     (check           check-derivation)
-     (requires-store? #t))
    (lint-checker
      (name            'profile-collisions)
      (description     "Report collisions that would occur due to propagated inputs")
@@ -1922,7 +1944,8 @@ (define %local-checkers
    (lint-checker
      (name        'formatting)
      (description "Look for formatting issues in the source")
-     (check       check-formatting))))
+     (check       check-formatting))
+   %derivation-checkers))
 
 (define %network-dependent-checkers
   (list
-- 
2.37.3





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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2022-11-06 13:55 [bug#59078] [PATCH] lint: Split the derivation lint checker by system Christopher Baines
@ 2022-11-07 17:37 ` Christopher Baines
  2022-11-11 21:57 ` Ludovic Courtès
  1 sibling, 0 replies; 11+ messages in thread
From: Christopher Baines @ 2022-11-07 17:37 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 59078

[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]


Christopher Baines <mail@cbaines.net> writes:

> This problem also impacts the Guix Data Service, since it tries to run the
> derivation checker for all packages.

This patch has now been processed by qa.guix.gnu.org. Looking at the
logs for the Guix Data Service processing the base and target revision,
and the change is more significant than I'd imagined:

Base:

  inferior heap after cleanup: 1739.0 MiB used (5160.0 MiB heap)
  debug: Finished getting formatting lint warnings, took 349 seconds
  debug: Finished fetching inferior lint warnings, took 3782 seconds

Target:

  inferior heap after cleanup: 1152.0 MiB used (1778.0 MiB heap)
  debug: Finished getting derivation/aarch64-linux lint warnings, took 334 seconds
  debug: Finished fetching inferior lint warnings, took 3285 seconds


So with the changes, it's a little faster, but the main difference is
that the heap ~3GiB smaller, so ~34% of what it was previously.

I did notice that this also subtly differs from how the linter behaved
previously, since some packages define support for systems not defined
through the platform module.

  https://data.qa.guix.gnu.org/compare?base_commit=a60dc46c2bb5de196858594b72b00d5f86ca7e98&target_commit=4e152714f55337015991e62e51e8dea15e889b9f

Personally, I think this change is still a good one. Maybe we can add a
separate linter to go round and check that packages don't declare
support for systems that aren't in the platform module.

Unless anyone objects, I'll like to push this sooner rather than later,
as I think the excessive heap size in the inferior process is not ideal.

Thanks,

Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2022-11-06 13:55 [bug#59078] [PATCH] lint: Split the derivation lint checker by system Christopher Baines
  2022-11-07 17:37 ` Christopher Baines
@ 2022-11-11 21:57 ` Ludovic Courtès
  2022-11-13 17:27   ` Christopher Baines
  1 sibling, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2022-11-11 21:57 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 59078

[-- Attachment #1: Type: text/plain, Size: 1957 bytes --]

Hi,

Christopher Baines <mail@cbaines.net> skribis:

> Currently, if you attempt to run the derivation checker on all packages, the
> Guile process will run out of memory. I think a contributing factor to this is
> that the checker forces an inefficient order when you want to generate
> derivations for all the supported systems of each package, constantly
> switching system then package.
>
> This problem also impacts the Guix Data Service, since it tries to run the
> derivation checker for all packages.
>
> The changes in this commit to split the derivation lint checker in to several,
> one for each system, means that you can now treat each system separately,
> which should be better for caching purposes.
>
> If it's desirable to keep some notion of checking all supported systems for a
> single package, I think lint checker groups could be added, so that you could
> ask for the "derivation" checker, and this would run all the derivation
> checkers.

The ‘derivation’ checker was added for this purpose: making sure that a
package’s derivation can be computed for all the supported systems.
Previously it was easy to overlook that kind of breakage.

I think it’s important to keep a ‘derivation’ checker that does this.


Now, the memory consumption you report is unacceptable and this needs to
be addressed.

Most (all?) caches are now per-session (associated with
<store-connection>).  Since ‘guix lint’ uses a single session, those
caches keep growing because there’s no eviction mechanism in place.

A hack like the one below should work around that.  Could you check how
well it works for you? It can also be helpful to set:

  GUIX_PROFILING=gc GUIX_PROFILING_EVENTS=after-gc

Longer-term we should have a proper cache eviction mechanism in place.
It’s not been a priority because “normal” applications such as ‘guix
package’ don’t need it.

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2392 bytes --]

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 9920c3ee62..6d9b9e96a9 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -209,23 +209,31 @@ (define (parse-options)
       (list-checkers-and-exit checkers))
 
     (with-error-handling
-      (let ((any-lint-checker-requires-store?
-             (any lint-checker-requires-store? checkers)))
+      (let ((store-needed? (any lint-checker-requires-store? checkers)))
 
-        (define (call-maybe-with-store proc)
-          (if any-lint-checker-requires-store?
-              (with-store store
-                (proc store))
-              (proc #f)))
-
-        (call-maybe-with-store
-         (lambda (store)
-           (cond
-            ((null? args)
-             (fold-packages (lambda (p r) (run-checkers p checkers
-                                                        #:store store)) '()))
-            (else
-             (for-each (lambda (package)
-                         (run-checkers package checkers
-                                       #:store store))
-                       args)))))))))
+        (cond
+         ((null? args)
+          (let loop ((packages  (fold-packages cons '()))
+                     (processed 0)
+                     (store     #f))
+            (match packages
+              ((package . rest)
+               (let ((store (and store-needed?
+                                 (if store
+                                     ;; XXX: Periodically start a new session
+                                     ;; with empty caches to avoid unbounded
+                                     ;; heap growth caused by the 'derivation'
+                                     ;; checker.
+                                     (if (zero? (modulo processed 1000))
+                                         (begin
+                                           (close-connection store)
+                                           (open-connection))
+                                         store)
+                                     (open-connection)))))
+                 (run-checkers package checkers #:store store)
+                 (loop rest (+ 1 processed) store))))))
+         (else
+          (for-each (lambda (package)
+                      (run-checkers package checkers
+                                    #:store store))
+                    args)))))))

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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2022-11-11 21:57 ` Ludovic Courtès
@ 2022-11-13 17:27   ` Christopher Baines
  2022-11-14 12:51     ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Christopher Baines @ 2022-11-13 17:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 59078

[-- Attachment #1: Type: text/plain, Size: 2747 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:

> Christopher Baines <mail@cbaines.net> skribis:
>
>> Currently, if you attempt to run the derivation checker on all packages, the
>> Guile process will run out of memory. I think a contributing factor to this is
>> that the checker forces an inefficient order when you want to generate
>> derivations for all the supported systems of each package, constantly
>> switching system then package.
>>
>> This problem also impacts the Guix Data Service, since it tries to run the
>> derivation checker for all packages.
>>
>> The changes in this commit to split the derivation lint checker in to several,
>> one for each system, means that you can now treat each system separately,
>> which should be better for caching purposes.
>>
>> If it's desirable to keep some notion of checking all supported systems for a
>> single package, I think lint checker groups could be added, so that you could
>> ask for the "derivation" checker, and this would run all the derivation
>> checkers.
>
> The ‘derivation’ checker was added for this purpose: making sure that a
> package’s derivation can be computed for all the supported systems.
> Previously it was easy to overlook that kind of breakage.
>
> I think it’s important to keep a ‘derivation’ checker that does this.

What aspect of it do you think is important?

I realise just splitting the checker in to several doesn't quite pick up
on all the same problems, but an additional checker could be added that
flags when packages support systems that don't appear as platforms. I
think that would catch everything that the derivation checker currently
does.

If it's a "we need a singular checker" kind of problem, I was thinking
of having some kind of lint checker groups. So you could have a group
called "derivation", which runs all of the relevant checkers.

> Now, the memory consumption you report is unacceptable and this needs to
> be addressed.
>
> Most (all?) caches are now per-session (associated with
> <store-connection>).  Since ‘guix lint’ uses a single session, those
> caches keep growing because there’s no eviction mechanism in place.
>
> A hack like the one below should work around that.  Could you check how
> well it works for you?

I tried in the Guix Data Service processing packages in chunks of 1000
plus closing the store connection after each batch, and that led to a
heap size of 3090MiB. But this is still higher than 1778MiB heap usage I
got just by splitting the derivation linter.

Fundamentally, I think it's still going to be more memory/time efficient
to move towards processing the derivations by system, rather than by
package.

Thanks,

Chris

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2022-11-13 17:27   ` Christopher Baines
@ 2022-11-14 12:51     ` Ludovic Courtès
  2022-11-15  8:35       ` Christopher Baines
  2022-11-15  9:03       ` zimoun
  0 siblings, 2 replies; 11+ messages in thread
From: Ludovic Courtès @ 2022-11-14 12:51 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 59078

Hi!

Christopher Baines <mail@cbaines.net> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:

[...]

>> The ‘derivation’ checker was added for this purpose: making sure that a
>> package’s derivation can be computed for all the supported systems.
>> Previously it was easy to overlook that kind of breakage.
>>
>> I think it’s important to keep a ‘derivation’ checker that does this.
>
> What aspect of it do you think is important?

I meant that it’s important to have a single ‘derivation’ checker that
checks derivations for all the supported systems.  Packagers should be
able to run ‘guix lint -c derivation PKG’ and be confident that it’s
fine for all systems.

>> Now, the memory consumption you report is unacceptable and this needs to
>> be addressed.
>>
>> Most (all?) caches are now per-session (associated with
>> <store-connection>).  Since ‘guix lint’ uses a single session, those
>> caches keep growing because there’s no eviction mechanism in place.
>>
>> A hack like the one below should work around that.  Could you check how
>> well it works for you?
>
> I tried in the Guix Data Service processing packages in chunks of 1000
> plus closing the store connection after each batch,

How was it implemented?  Was it after the caches came into
<store-connection>?

> and that led to a heap size of 3090MiB. But this is still higher than
> 1778MiB heap usage I got just by splitting the derivation linter.

I didn’t take the time to do it, but it would be nice to see, with the
patch I gave, how ‘guix lint -c derivations’ behaves.

Thanks,
Ludo’.




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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2022-11-14 12:51     ` Ludovic Courtès
@ 2022-11-15  8:35       ` Christopher Baines
  2022-11-17 17:22         ` Ludovic Courtès
  2022-11-15  9:03       ` zimoun
  1 sibling, 1 reply; 11+ messages in thread
From: Christopher Baines @ 2022-11-15  8:35 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 59078

[-- Attachment #1: Type: text/plain, Size: 4341 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:

> Hi!
>
> Christopher Baines <mail@cbaines.net> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>
> [...]
>
>>> The ‘derivation’ checker was added for this purpose: making sure that a
>>> package’s derivation can be computed for all the supported systems.
>>> Previously it was easy to overlook that kind of breakage.
>>>
>>> I think it’s important to keep a ‘derivation’ checker that does this.
>>
>> What aspect of it do you think is important?
>
> I meant that it’s important to have a single ‘derivation’ checker that
> checks derivations for all the supported systems.  Packagers should be
> able to run ‘guix lint -c derivation PKG’ and be confident that it’s
> fine for all systems.

I think we can still keep that by adding support for grouping lint
checkers. So have a derivation group, instead of a single checker.

Maybe that'll change the command slightly to 'guix lint -g derivation
PKG', but I think that can be equivalent.

>>> Now, the memory consumption you report is unacceptable and this needs to
>>> be addressed.
>>>
>>> Most (all?) caches are now per-session (associated with
>>> <store-connection>).  Since ‘guix lint’ uses a single session, those
>>> caches keep growing because there’s no eviction mechanism in place.
>>>
>>> A hack like the one below should work around that.  Could you check how
>>> well it works for you?
>>
>> I tried in the Guix Data Service processing packages in chunks of 1000
>> plus closing the store connection after each batch,
>
> How was it implemented?  Was it after the caches came into
> <store-connection>?

I'm not sure what aspect of the implementation is important, but I think
it's working correctly. Closing the store connection wasn't very
easy. Previously there was a fresh store connection with each call to
inferior-eval-with-store, but for this test I close the connections in
%store-table and then clear the hash table between the
inferior-eval-with-store calls.

>> and that led to a heap size of 3090MiB. But this is still higher than
>> 1778MiB heap usage I got just by splitting the derivation linter.
>
> I didn’t take the time to do it, but it would be nice to see, with the
> patch I gave, how ‘guix lint -c derivations’ behaves.

I've put some numbers below, with no changes the last batch to finish
processing leaves the heap at 7755MiB [1], then Guile crashes after
that.

With the patch you sent, the heap size seems to stabilise at 4042MiB
[2]. It also crashes at the end due to the match block not matching '(),
but that's not important.

I also hacked the lint script to run the checkers in the same manor as
the Guix Data Service, so one checker at a time rather than one package
at a time. That led to a max heap size of 3505MiB [3].

By adding in batching (as the Guix Data Service already does), I think
it's possible to further reduce this to the 1778MiB number I give above.

Reducing the memory usage helps reduce the cost/improve the throughput
of loading data in to the Guix Data Service which is my primary
motivation here. I'm also not only concerned with reducing the peak
memory usage, but trying to have an implementation that'll gracefully
handle more systems being supported in the future.

It's for that second point that I think arranging the derivation linting
so that it's possible to process each system in turn is important for
the Guix Data Service, so that when new platforms are added, the memory
usage won't grow as much.


1: no batching, one derivation checker
1065.0 MiB
1409.0 MiB
2089.0 MiB
2297.0 MiB
2513.0 MiB
2705.0 MiB
3077.0 MiB
3373.0 MiB
3557.0 MiB
3661.0 MiB
3901.0 MiB
3997.0 MiB
4147.0 MiB
4491.0 MiB
4635.0 MiB
5899.0 MiB
7755.0 MiB

2: batches of 1000 with fresh store connection, one derivation checker
1057.0 MiB
1137.0 MiB
1481.0 MiB
1481.0 MiB
1481.0 MiB
1481.0 MiB
1697.0 MiB
1697.0 MiB
1697.0 MiB
1761.0 MiB
1761.0 MiB
1761.0 MiB
1937.0 MiB
1977.0 MiB
1985.0 MiB
3065.0 MiB
3633.0 MiB
4041.0 MiB
4042.0 MiB
4042.0 MiB
4042.0 MiB

3: multiple derivation checkers, batched by system
1297.0 MiB
1545.0 MiB
1873.0 MiB
2113.0 MiB
2353.0 MiB
2609.0 MiB
2961.0 MiB
3193.0 MiB
3505.0 MiB



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2022-11-14 12:51     ` Ludovic Courtès
  2022-11-15  8:35       ` Christopher Baines
@ 2022-11-15  9:03       ` zimoun
  2023-01-27 17:48         ` Simon Tournier
  1 sibling, 1 reply; 11+ messages in thread
From: zimoun @ 2022-11-15  9:03 UTC (permalink / raw)
  To: Ludovic Courtès, Christopher Baines; +Cc: 59078

Hi,

On Mon, 14 Nov 2022 at 13:51, Ludovic Courtès <ludo@gnu.org> wrote:

> I meant that it’s important to have a single ‘derivation’ checker that
> checks derivations for all the supported systems.  Packagers should be
> able to run ‘guix lint -c derivation PKG’ and be confident that it’s
> fine for all systems.

The CLI invokation is unrelated to the invoked checkers, no?  As Chris
is proposing, it seems being worth to group some checkers.  For
instance, we already have the option ’-n, --no-network’ which does that
but probably at the wrong level.

Maybe we could have another command line option,

    guix lint --group=no-network
    guix lint --group=derivation
    guix lint --group=no-network,derivation

I do not know…


Cheers,
simon




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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2022-11-15  8:35       ` Christopher Baines
@ 2022-11-17 17:22         ` Ludovic Courtès
  0 siblings, 0 replies; 11+ messages in thread
From: Ludovic Courtès @ 2022-11-17 17:22 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 59078

Hi,

Christopher Baines <mail@cbaines.net> skribis:

> I've put some numbers below, with no changes the last batch to finish
> processing leaves the heap at 7755MiB [1], then Guile crashes after
> that.
>
> With the patch you sent, the heap size seems to stabilise at 4042MiB
> [2]. It also crashes at the end due to the match block not matching '(),
> but that's not important.
>
> I also hacked the lint script to run the checkers in the same manor as
> the Guix Data Service, so one checker at a time rather than one package
> at a time. That led to a max heap size of 3505MiB [3].

Thanks for testing and reporting back!

> Reducing the memory usage helps reduce the cost/improve the throughput
> of loading data in to the Guix Data Service which is my primary
> motivation here. I'm also not only concerned with reducing the peak
> memory usage, but trying to have an implementation that'll gracefully
> handle more systems being supported in the future.

Understood.  From the viewpoint of core Guix, I’d like to understand
where all this memory is going; this is unreasonable.  The heap profiler
I posted recently¹, coupled with ‘gcprof’, might help us understand
what’s going on.

¹ https://lists.gnu.org/archive/html/guile-user/2022-11/msg00012.html

> 1: no batching, one derivation checker

[...]

> 7755.0 MiB
>
> 2: batches of 1000 with fresh store connection, one derivation checker
> 1057.0 MiB
> 1137.0 MiB
> 1481.0 MiB
> 1481.0 MiB
> 1481.0 MiB
> 1481.0 MiB
> 1697.0 MiB
> 1697.0 MiB
> 1697.0 MiB
> 1761.0 MiB
> 1761.0 MiB
> 1761.0 MiB
> 1937.0 MiB
> 1977.0 MiB
> 1985.0 MiB
> 3065.0 MiB
> 3633.0 MiB
> 4041.0 MiB
> 4042.0 MiB
> 4042.0 MiB
> 4042.0 MiB

This seems to indicate a memory leak outside <store-connection>, such as
a static cache.  “GUIX_PROFILING=memoization” may give a hint.

I’d really like to get it solved before we come up with workarounds like
those we’re talking about.  (However I’ll postpone this one because I’d
like to focus on the release for now.)

Thanks,
Ludo’.




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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2022-11-15  9:03       ` zimoun
@ 2023-01-27 17:48         ` Simon Tournier
  2023-01-31 16:33           ` Ludovic Courtès
  0 siblings, 1 reply; 11+ messages in thread
From: Simon Tournier @ 2023-01-27 17:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Christopher Baines, 59078

Hi,

On mar., 15 nov. 2022 at 10:03, zimoun <zimon.toutoune@gmail.com> wrote:
> On Mon, 14 Nov 2022 at 13:51, Ludovic Courtès <ludo@gnu.org> wrote:
>
>> I meant that it’s important to have a single ‘derivation’ checker that
>> checks derivations for all the supported systems.  Packagers should be
>> able to run ‘guix lint -c derivation PKG’ and be confident that it’s
>> fine for all systems.
>
> The CLI invokation is unrelated to the invoked checkers, no?  As Chris
> is proposing, it seems being worth to group some checkers.  For
> instance, we already have the option ’-n, --no-network’ which does that
> but probably at the wrong level.
>
> Maybe we could have another command line option,
>
>     guix lint --group=no-network
>     guix lint --group=derivation
>     guix lint --group=no-network,derivation

What about this?


Cheers,
simon




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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2023-01-27 17:48         ` Simon Tournier
@ 2023-01-31 16:33           ` Ludovic Courtès
  2023-02-01  9:47             ` zimoun
  0 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2023-01-31 16:33 UTC (permalink / raw)
  To: Simon Tournier; +Cc: Christopher Baines, 59078

Hi,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

> On mar., 15 nov. 2022 at 10:03, zimoun <zimon.toutoune@gmail.com> wrote:
>> On Mon, 14 Nov 2022 at 13:51, Ludovic Courtès <ludo@gnu.org> wrote:
>>
>>> I meant that it’s important to have a single ‘derivation’ checker that
>>> checks derivations for all the supported systems.  Packagers should be
>>> able to run ‘guix lint -c derivation PKG’ and be confident that it’s
>>> fine for all systems.
>>
>> The CLI invokation is unrelated to the invoked checkers, no?  As Chris
>> is proposing, it seems being worth to group some checkers.  For
>> instance, we already have the option ’-n, --no-network’ which does that
>> but probably at the wrong level.
>>
>> Maybe we could have another command line option,
>>
>>     guix lint --group=no-network
>>     guix lint --group=derivation
>>     guix lint --group=no-network,derivation
>
> What about this?

In general, being able to tell which category a checker belongs to, and
then being able to select checkers by categories sounds like a useful
improvement to me.

I don’t think it solves the problem Christopher initially reported
though (about memory consumption of the ‘derivation’ checker.)

Ludo’.




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

* [bug#59078] [PATCH] lint: Split the derivation lint checker by system.
  2023-01-31 16:33           ` Ludovic Courtès
@ 2023-02-01  9:47             ` zimoun
  0 siblings, 0 replies; 11+ messages in thread
From: zimoun @ 2023-02-01  9:47 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Christopher Baines, 59078

Hi Ludo,

On Tue, 31 Jan 2023 at 17:33, Ludovic Courtès <ludo@gnu.org> wrote:

> In general, being able to tell which category a checker belongs to, and
> then being able to select checkers by categories sounds like a useful
> improvement to me.
>
> I don’t think it solves the problem Christopher initially reported
> though (about memory consumption of the ‘derivation’ checker.)

Indeed.  My understanding of the proposal is to split some checkers (as
derivation) and then group them to have the expected behaviour.  You
wrote [1]:

        I meant that it’s important to have a single ‘derivation’
        checker that checks derivations for all the supported systems.
        Packagers should be able to run ‘guix lint -c derivation PKG’
        and be confident that it’s fine for all systems.

and Chris answered [2]:

        I think we can still keep that by adding support for grouping
        lint checkers. So have a derivation group, instead of a single
        checker.

        Maybe that'll change the command slightly to 'guix lint -g derivation
        PKG', but I think that can be equivalent.

where I try to feed Chris’s proposal. :-)

I do not know if it is the correct level but being able to run “smaller“
checkers appears to me worth to try.

1: http://issues.guix.gnu.org/msgid/87h6z1puli.fsf@gnu.org
2: http://issues.guix.gnu.org/msgid/87leocfsnm.fsf@cbaines.net

Cheers,
simon




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

end of thread, other threads:[~2023-02-01 10:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-06 13:55 [bug#59078] [PATCH] lint: Split the derivation lint checker by system Christopher Baines
2022-11-07 17:37 ` Christopher Baines
2022-11-11 21:57 ` Ludovic Courtès
2022-11-13 17:27   ` Christopher Baines
2022-11-14 12:51     ` Ludovic Courtès
2022-11-15  8:35       ` Christopher Baines
2022-11-17 17:22         ` Ludovic Courtès
2022-11-15  9:03       ` zimoun
2023-01-27 17:48         ` Simon Tournier
2023-01-31 16:33           ` Ludovic Courtès
2023-02-01  9:47             ` zimoun

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.