all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Bavier <ericbavier@centurylink.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 37510@debbugs.gnu.org, bavier <bavier@member.fsf.org>
Subject: [bug#37510] [PATCH 1/1] compile: Fix race condition on completion progress.
Date: Thu, 26 Sep 2019 09:42:45 -0400 (EDT)	[thread overview]
Message-ID: <58295170.37303056.1569505365844.JavaMail.zimbra@centurylink.net> (raw)
In-Reply-To: <87pnjnpfsz.fsf@gnu.org>

----- On Sep 26, 2019, at 4:28 AM, Ludovic Courtès ludo@gnu.org wrote:

> Hello,
> 
> ericbavier@centurylink.net skribis:
> 
>> From: Eric Bavier <bavier@member.fsf.org>
>>
>> This prevent a race condition where multiple compilation threads could report
>> the same completion.
>>
>> * guix/build/compile.scm (compile-files)<completed>: 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
> 
> I think it’s 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’s confusing though.  :-)

Right.  If we did indeed expect to see completion at the time we started, then I would expect to see "0%" displayed with the first "LOAD".

> 
>> +++ 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)))
> 
> Here ‘completed’ is incremented before the thing is even started.

Maybe a more generic name like "progress" would be appropriate?

> 
> Anyway, LGTM!  :-)

Thanks for reviewing.

-- 
`~Eric

  reply	other threads:[~2019-09-26 13:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25  2:07 [bug#37510] [PATCH 1/1] compile: Fix race condition on completion progress ericbavier
2019-09-26  9:28 ` Ludovic Courtès
2019-09-26 13:42   ` Eric Bavier [this message]
2019-09-26 20:57     ` Ludovic Courtès
2019-09-28  4:01       ` bug#37510: " Eric Bavier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58295170.37303056.1569505365844.JavaMail.zimbra@centurylink.net \
    --to=ericbavier@centurylink.net \
    --cc=37510@debbugs.gnu.org \
    --cc=bavier@member.fsf.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.