From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:56453) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDQ5A-0002bu-Hw for guix-patches@gnu.org; Thu, 26 Sep 2019 05:29:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDQ59-0007u5-CW for guix-patches@gnu.org; Thu, 26 Sep 2019 05:29:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33863) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDQ59-0007sC-9b for guix-patches@gnu.org; Thu, 26 Sep 2019 05:29:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iDQ58-0006O9-BB for guix-patches@gnu.org; Thu, 26 Sep 2019 05:29:02 -0400 Subject: [bug#37510] [PATCH 1/1] compile: Fix race condition on completion progress. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: ericbavier@centurylink.net Cc: 37510@debbugs.gnu.org, Eric Bavier 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.