From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 24 22:06:38 2019 Received: (at submit) by debbugs.gnu.org; 25 Sep 2019 02:06:38 +0000 Received: from localhost ([127.0.0.1]:40683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iCwhR-0003i4-Mx for submit@debbugs.gnu.org; Tue, 24 Sep 2019 22:06:37 -0400 Received: from lists.gnu.org ([209.51.188.17]:44439) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iCwhP-0003hv-LU for submit@debbugs.gnu.org; Tue, 24 Sep 2019 22:06:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39470) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCwhO-0006kK-6g for guix-patches@gnu.org; Tue, 24 Sep 2019 22:06:35 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: *** X-Spam-Status: No, score=3.2 required=5.0 tests=BAYES_50,FREEMAIL_FROM, KHOP_HELO_FCRDNS,SPOOFED_FREEMAIL,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCwhM-0005Or-OJ for guix-patches@gnu.org; Tue, 24 Sep 2019 22:06:34 -0400 Received: from mail.onyx.syn-alias.com ([206.152.134.66]:56911 helo=smtp.centurylink.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iCwhM-0005OP-ER for guix-patches@gnu.org; Tue, 24 Sep 2019 22:06:32 -0400 DKIM-Signature: v=1; a=rsa-sha1; d=centurylink.net; s=ctl201402; c=relaxed/simple; q=dns/txt; i=@centurylink.net; t=1569377190; h=From:Subject:Date:To:MIME-Version; bh=udzrOpDlk+LBMGaQquhPBy1/2+I=; b=VUGW9E53k1WT6frVD2QvrwsNVbciUqklGfc+Klh/ECWyEl8isZcvF6Jo26BoS+Ah BiMaxXQELY8ZlR7i5NLl3sxLktswwRazgejQ3SJ1q5VftOqKp3lUTdfY7e73EMEI MkmnFcr+vvVJP1cvt+JPLwBy66G+kMSP3XF4VXDjS4zXqIj7AdWrQUwBbD4v1W9o gwQcCIwNX/yKgY7RAc/YWTeskOTrjPktnPO6mHNLORAFoF2nPpuG/QHF4xfSNffG T8gfDi0/tUCCAQrROpHlnyMe2jmSOSO2ASPvPRXvAqOwBXoXyP6Im1hjHh5XcRxE yg15my2vOtydHoRgFTJAYQ==; X_CMAE_Category: , , X-CNFS-Analysis: v=2.3 cv=LaBCFQXi c=1 sm=1 tr=0 a=GVJ9LTFkbBq9teHl4Ync7A==:117 a=GVJ9LTFkbBq9teHl4Ync7A==:17 a=KGjhK52YXX0A:10 a=J70Eh1EUuV4A:10 a=zSv6zi-ZgakA:10 a=eQrCS-SpgXYA:10 a=inoG4m36AAAA:8 a=Y7uwgHWIDVd_fXGyKMIA:9 a=_Qgj-RFg6mImvLaOgLPg:22 X-CM-Score: 0 X-Scanned-by: Cloudmark Authority Engine Feedback-ID: dfw:ctl:res:onyx X-Authed-Username: ZXJpY2JhdmllckBjZW50dXJ5bGluay5uZXQ= Authentication-Results: smtp04.onyx.dfw.sync.lan smtp.user=ericbavier@centurylink.net; auth=pass (LOGIN) Received: from [65.128.96.128] ([65.128.96.128:55390] helo=localhost.localdomain) by smtp.centurylink.net (envelope-from ) (ecelerity 3.6.25.56547 r(Core:3.6.25.0)) with ESMTPSA (cipher=DHE-RSA-AES128-GCM-SHA256) id 23/53-23246-6ABCA8D5; Tue, 24 Sep 2019 22:06:30 -0400 From: ericbavier@centurylink.net To: guix-patches@gnu.org Subject: [PATCH 1/1] compile: Fix race condition on completion progress. Date: Tue, 24 Sep 2019 21:07:06 -0500 Message-Id: <20190925020706.6034-1-ericbavier@centurylink.net> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 206.152.134.66 X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit Cc: 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.3 (/) From: Eric Bavier This prevent a race condition where multiple compilation threads could report the same completion. * guix/build/compile.scm (compile-files): Increment in same mutex 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 update, 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/haskell.go ;;; note: source file ./gnu/packages/haskell.scm ;;; newer than compiled /home/bavier/projects/guix/gnu/packages/haskell.go [ 50%] LOAD gnu/packages/idris.scm ;;; note: source file ./gnu/packages/idris.scm ;;; newer than compiled /home/bavier/projects/guix/gnu/packages/idris.go ;;; note: source file ./gnu/packages/idris.scm ;;; newer than compiled /home/bavier/projects/guix/gnu/packages/idris.go [ 75%] GUILEC gnu/packages/haskell.go [ 75%] GUILEC gnu/packages/idris.go make[2]: Leaving directory '/home/bavier/projects/guix' make[1]: Leaving directory '/home/bavier/projects/guix' ``` --- guix/build/compile.scm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/guix/build/compile.scm b/guix/build/compile.scm index c127456fd0..f77e49340a 100644 --- a/guix/build/compile.scm +++ b/guix/build/compile.scm @@ -173,7 +173,8 @@ files are for HOST, a GNU triplet such as \"x86_64-linux-gnu\"." (define (build file) (with-mutex progress-lock - (report-compilation file total completed)) + (report-compilation file total completed) + (set! completed (+ 1 completed))) ;; Exit as soon as something goes wrong. (exit-on-exception @@ -185,9 +186,7 @@ files are for HOST, a GNU triplet such as \"x86_64-linux-gnu\"." #:output-file (string-append build-directory "/" (scm->go relative)) #:opts (append warning-options - (optimization-options relative))))))) - (with-mutex progress-lock - (set! completed (+ 1 completed)))) + (optimization-options relative)))))))) (with-augmented-search-path %load-path source-directory (with-augmented-search-path %load-compiled-path build-directory -- 2.23.0