Avoid concurrency issue when make multiple target #13465

pull ken2812221 wants to merge 1 commits into bitcoin:master from ken2812221:no_parallel changing 1 files +2 −2
  1. ken2812221 commented at 12:59 AM on June 14, 2018: contributor

    From #13406, changed travis job target for Mac to all deploy, but this could cause a race condition. Simply add .NOTPARALLEL to avoid it. Related jobs: https://travis-ci.org/bitcoin/bitcoin/jobs/391863281 https://travis-ci.org/bitcoin/bitcoin/jobs/391907335 Close #13469

  2. fanquake added the label Build system on Jun 14, 2018
  3. fanquake commented at 1:21 AM on June 14, 2018: member

    From make: Special Targets:

    .NOTPARALLEL

    If .NOTPARALLEL is mentioned as a target, then this invocation of make will be run serially, even if the ā€˜-j’ option is given. Any recursively invoked make command will still run recipes in parallel (unless its makefile also contains this target). Any prerequisites on this target are ignored.

  4. fanquake requested review from theuni on Jun 14, 2018
  5. laanwj commented at 11:23 AM on June 14, 2018: member

    Will this make the entire build non-parallel? If so, that would be bad.

  6. ken2812221 commented at 11:54 AM on June 14, 2018: contributor

    Will this make the entire build non-parallel? If so, that would be bad.

    As @fanquake posted

    Any recursively invoked make command will still run recipes in parallel

    The code building targets are still can run in parallel because they are in src/Makefile, this change only affect the target in the top Makefile.

  7. laanwj commented at 3:55 PM on June 14, 2018: member

    ok utACK from me in that case

  8. theuni commented at 5:06 PM on June 14, 2018: member

    If there's a race condition, something's broken. We should clarify the dependencies rather than serializing. Any idea where things break down?

  9. promag commented at 5:31 PM on June 14, 2018: member

    Agree with @theuni, looks like this avoids a problem instead of fixing it.

  10. theuni commented at 5:34 PM on June 14, 2018: member

    I think that this should be enough to fix it. Untested:

    diff --git a/Makefile.am b/Makefile.am
    index 8a8debb..3a725d3 100644
    --- a/Makefile.am
    +++ b/Makefile.am
    @@ -95,7 +95,7 @@ $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
            $(MKDIR_P) $(@D)
            $(INSTALL_DATA) $< $@
    
    -$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
    +$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: all-recursive
            $(MKDIR_P) $(@D)
            STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM)  $< $@
    
    

    I believe the issue is that the top-level calls a sub-make for all, as well as for src/qt/bitcoin-qt, and those end up racing. Solve that by having deploy depend on the sub-make already being complete, which also matches the way the Windows dependencies are handled.

    As a side-effect, this makes make deploy do what you wanted it to do in the beginning :)

  11. ken2812221 force-pushed on Jun 14, 2018
  12. Avoid concurrency issue cf01fd6f9c
  13. ken2812221 force-pushed on Jun 14, 2018
  14. ken2812221 commented at 11:32 PM on June 14, 2018: contributor

    @theuni Fixed

  15. promag commented at 11:56 PM on June 14, 2018: member

    utACK cf01fd6, makes sense!

  16. theuni commented at 5:09 PM on June 15, 2018: member

    @ken2812221 Thanks!

    Tested locally. I can easily reproduce the racy build failure in master, and this appears to fix it.

  17. theuni approved
  18. MarcoFalke referenced this in commit 81069a75bd on Jun 15, 2018
  19. MarcoFalke merged this on Jun 15, 2018
  20. MarcoFalke closed this on Jun 15, 2018

  21. ken2812221 deleted the branch on Jun 15, 2018
  22. PastaPastaPasta referenced this in commit 965d601285 on Jul 7, 2020
  23. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me