From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 26 05:28:37 2019 Received: (at 37510) by debbugs.gnu.org; 26 Sep 2019 09:28:37 +0000 Received: from localhost ([127.0.0.1]:42684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDQ4j-0006NX-Aa for submit@debbugs.gnu.org; Thu, 26 Sep 2019 05:28:37 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:58834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDQ4e-0006NI-3x for 37510@debbugs.gnu.org; Thu, 26 Sep 2019 05:28:36 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id BFBFAA5AEC; Thu, 26 Sep 2019 11:28:29 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GMdFFvzO6pW4; Thu, 26 Sep 2019 11:28:29 +0200 (CEST) Received: from ribbon (unknown [IPv6:2001:660:6102:320:e120:2c8f:8909:cdfe]) by hera.aquilenet.fr (Postfix) with ESMTPSA id B9833A5AEB; Thu, 26 Sep 2019 11:28:28 +0200 (CEST) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: ericbavier@centurylink.net Subject: Re: [bug#37510] [PATCH 1/1] compile: Fix race condition on completion progress. References: <20190925020706.6034-1-ericbavier@centurylink.net> Date: Thu, 26 Sep 2019 11:28:28 +0200 In-Reply-To: <20190925020706.6034-1-ericbavier@centurylink.net> (ericbavier@centurylink.net's message of "Tue, 24 Sep 2019 21:07:06 -0500") Message-ID: <87pnjnpfsz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 37510 Cc: 37510@debbugs.gnu.org, Eric Bavier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hello, ericbavier@centurylink.net skribis: > From: Eric Bavier > > This prevent a race condition where multiple compilation threads could re= port > the same completion. > > * guix/build/compile.scm (compile-files): Increment in same mu= tex > region as the compilation is reported. > > > Further reading: > > When compiling many scheme files, or with '-j1', this is not usually a > problem, but with multiple build jobs and a handful of scheme files to up= date, > you may encounter unexpected output. E.g. I recently saw this from `make= -j2`: > > ``` > Compiling Scheme modules... > [ 25%] LOAD gnu/packages/haskell.scm > ;;; note: source file ./gnu/packages/haskell.scm > ;;; newer than compiled /home/bavier/projects/guix/gnu/packages/has= kell.go > ;;; note: source file ./gnu/packages/haskell.scm > ;;; newer than compiled /home/bavier/projects/guix/gnu/packages/has= kell.go > [ 50%] LOAD gnu/packages/idris.scm > ;;; note: source file ./gnu/packages/idris.scm > ;;; newer than compiled /home/bavier/projects/guix/gnu/packages/idr= is.go > ;;; note: source file ./gnu/packages/idris.scm > ;;; newer than compiled /home/bavier/projects/guix/gnu/packages/idr= is.go > [ 75%] GUILEC gnu/packages/haskell.go > [ 75%] GUILEC gnu/packages/idris.go I think it=E2=80=99s expected: it shows completion at the time we started to build these files. Compilation of haskell.scm and idris.scm started at the same time, and at that point we had built 75% of the files. I agree it=E2=80=99s confusing though. :-) > +++ b/guix/build/compile.scm > @@ -173,7 +173,8 @@ files are for HOST, a GNU triplet such as \"x86_64-li= nux-gnu\"." >=20=20 > (define (build file) > (with-mutex progress-lock > - (report-compilation file total completed)) > + (report-compilation file total completed) > + (set! completed (+ 1 completed))) Here =E2=80=98completed=E2=80=99 is incremented before the thing is even st= arted. Anyway, LGTM! :-) Ludo=E2=80=99.