From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id WNF1H4fFbmMGWgAAbAwnHQ (envelope-from ) for ; Fri, 11 Nov 2022 22:58:31 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id UHC8HofFbmPsnAAAG6o9tA (envelope-from ) for ; Fri, 11 Nov 2022 22:58:31 +0100 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 28525130E7 for ; Fri, 11 Nov 2022 22:58:30 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otc2G-0003um-GQ; Fri, 11 Nov 2022 16:58:04 -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 1otc2E-0003uM-N5 for guix-patches@gnu.org; Fri, 11 Nov 2022 16:58:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otc2E-0000gx-Ec for guix-patches@gnu.org; Fri, 11 Nov 2022 16:58:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1otc2E-0003GE-BP for guix-patches@gnu.org; Fri, 11 Nov 2022 16:58:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59078] [PATCH] lint: Split the derivation lint checker by system. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 11 Nov 2022 21:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59078 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: 59078@debbugs.gnu.org Received: via spool by 59078-submit@debbugs.gnu.org id=B59078.166820386812514 (code B ref 59078); Fri, 11 Nov 2022 21:58:02 +0000 Received: (at 59078) by debbugs.gnu.org; 11 Nov 2022 21:57:48 +0000 Received: from localhost ([127.0.0.1]:46914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otc20-0003Fm-3G for submit@debbugs.gnu.org; Fri, 11 Nov 2022 16:57:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:32934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otc1x-0003FY-Mb for 59078@debbugs.gnu.org; Fri, 11 Nov 2022 16:57:46 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otc1s-0000f9-Fd; Fri, 11 Nov 2022 16:57:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=cuVrb0nyfLdB1+jaQibg2Rr8Wzu0A8bSFxThvMvT2nc=; b=BAFpAcm0760ubEHe91NV dvQN8JFS+pGM0LYBU6Nx1mqrd+zKiJdP4P+AWGJ5Wql78UCQt7W6SRdscROqhyiRtTi1HhL91bM0d FeSU6Cva/s9hUnHEYtC8G4I2QTl7kCT8xYyPQsX5piUl5ri9NYm9oBqXoyeVRFjNX678Hce7Upxs+ mtVvXbhm+Zb722mjqBpwIEXMYfg8DTNY58MicdPClTubqxMssGFcIQanWr5ea1o11CNiMGRRjZved XgC8KsDVRhAioyZzB0vXCsDVEQtrSBUIPeQDprBrhAwFtMiP4+8Mbtg1xv9u8UEc5xXMVuqK1wTpY PHxCCljAdHgG5g==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otc1q-0007vv-MM; Fri, 11 Nov 2022 16:57:40 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20221106135532.5724-1-mail@cbaines.net> Date: Fri, 11 Nov 2022 22:57:36 +0100 In-Reply-To: <20221106135532.5724-1-mail@cbaines.net> (Christopher Baines's message of "Sun, 6 Nov 2022 14:55:32 +0100") Message-ID: <87k041dui7.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668203911; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: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=cuVrb0nyfLdB1+jaQibg2Rr8Wzu0A8bSFxThvMvT2nc=; b=SqrgWxvagaVVVfRiW6e9qXqigeQ+Op5mUQHUqlilzZ21SKIfKq4VYrBj7+tD2gjZG3etqB qV386+HjsdW1RzlrLm0MkiX9Wu0G/LOmSiHuJv+2WCfMFMdhuMAD2jCwuPoAiiT4j47Fed rHD2bcYbihNEYSeQBDHxYqzMHjMamKE5QxklMUzqPvGMK+dcTriTw9Z86Z3ZmY1Fa5+LpU h9akv+dwGmLquSn8oLLPOkuvGeKifpmXtFjwvfhuOmBlCNOYzWiMMsGrttou/h+5cB6oCQ EXH/a8EaNOd+m/tnNrgusYeLkzxxu6veVWA3NKCCszgWpo64UUyZl+JyfrhG8Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668203911; a=rsa-sha256; cv=none; b=Sksy8Z6FnUOtaUx51DC5ISjJSlIJMNOKhqaCy1rvEJDUDFc3kdbHiQZ0L/iFkZ3Nkw96/+ 7HScROiUFaVePsAosvFNZxuPW9hXu6ohaMxHKxHMAKDnVXU3g8U+pwUxHuLQHqOXw+Psfe s6X1CeLMfear73DntWrrQyP1vgCxtQ5A8zcvdb5oT9noEonRTrMNgTcdUEFRX5HaRbdcau FbLMKFOuoPtOQNcHI0z4nvQG6/Jgsewnq6eabSvXusZXnoedc2QNax9eesdcJRUJJRdw7i Gc21thEPI3B4Di+OoDpvqdeMlViQzS+rUWliz92PPSp0/CSi9dKvcPHioJsjFA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=BAFpAcm0; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Spam-Score: -2.93 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=BAFpAcm0; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Queue-Id: 28525130E7 X-Spam-Score: -2.93 X-Migadu-Scanner: scn1.migadu.com X-TUID: yXY+ClMU0yjN --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Christopher Baines 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 th= is 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 sev= eral, > 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 f= or a > single package, I think lint checker groups could be added, so that you c= ould > ask for the "derivation" checker, and this would run all the derivation > checkers. The =E2=80=98derivation=E2=80=99 checker was added for this purpose: making= sure that a package=E2=80=99s derivation can be computed for all the supported systems. Previously it was easy to overlook that kind of breakage. I think it=E2=80=99s important to keep a =E2=80=98derivation=E2=80=99 check= er 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 ). Since =E2=80=98guix lint=E2=80=99 uses a single sessi= on, those caches keep growing because there=E2=80=99s 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=3Dgc GUIX_PROFILING_EVENTS=3Dafter-gc Longer-term we should have a proper cache eviction mechanism in place. It=E2=80=99s not been a priority because =E2=80=9Cnormal=E2=80=9D applicati= ons such as =E2=80=98guix package=E2=80=99 don=E2=80=99t need it. Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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))))))) --=-=-=--