Skip to content

GitVersionTask Parallel restore issue when multi targeting #1381

Closed

Description

@dazinator

I am noticing this issue in my NETSTANDARD PR branch, but I think it might impact master as well (although not tested master directly I am inferring it is a problem)

The issue is, the following target runs when restoring:

  <Target Name="WriteVersionInfoToBuildLog" BeforeTargets="DispatchToInnerBuilds;GenerateNuspec;_GenerateRestoreProjectSpec" Condition="$(WriteVersionInfoToBuildLog) == 'true'">
    <WriteVersionInfoToBuildLog SolutionDirectory="$(GitVersionPath)" NoFetch="$(GitVersion_NoFetchEnabled)"/>
  </Target>

The WriteVersionInfoToBuildLog msbuild task ends up calling ExecuteGitVersion which ends up using libgit2sharp.

If you are restoring a solution with dotnet restore (I am not sure about /T:Restore but I assume it's the same?) restoration happens in parallel unless you opt out via dotnet restore --disable-parallel switch.

Because of this, I am seeing libgit2sharp throw errors about locking as it's being used in parallel to inspect the same repo:

https://ci.appveyor.com/project/dazinator/gitversion-pr1269/build/0.1.1+5.build.1#L32

Activity

  1. dazinator commented on Mar 11, 2018

    @dazinator
    ContributorAuthor

    This might be down to an error in my PR branch, I'll reopen once I know for sure it's an issue in master.

  2. dazinator commented on Mar 11, 2018

    @dazinator
    ContributorAuthor

    This issue seems only relevant to dotnet build, if you use msbuild /t:build or msbuild /t:Restore its fine.

    I beleive this is because dotnet build now implictly does a dotnet restore. And dotnet restore is done in parralel unless you opt out using --disable-parallel.

    This causes a problem for our build task, libgit2sharp keeps locks and doesn't like to be used concurrently.

    Therefore in my sample repo in order to work around this I have had to use dotnet restore --disable-parallel.

  3. stale commented on Jun 29, 2019

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

  4. dazinator commented on Jul 29, 2019

    @dazinator
    ContributorAuthor

    This should probably result in a docs change - i.e gitversiontask doesn't support building projects in parallel, which is a build switch that should be disabled

  5. stale commented on Oct 27, 2019

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

  6. ivan-danilov commented on Nov 13, 2019

    @ivan-danilov
    Contributor

    Not supporting parallel build is often a show-stopper for big solutions. Turning parallel build off easily makes 3-minutes build into 15-minutes. Do you take votes on what is the most important? Count mine here ;)

  7. 33 remaining items

  8. stale commented on Mar 19, 2021

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

  9. bording commented on Apr 16, 2021

    @bording
    Contributor

    This is definitely still a problem when using the GitVersion.MsBuild package, including the 5.6.8 package. Yes, there are options to workaround it, but I think that it makes sense to fix things so that the package works without requiring everyone to disable parallel builds or otherwise alter how GitVersion.MsBuild works by default.

  10. SeppPenner commented on Apr 18, 2021

    @SeppPenner

    I was facing no problems with 5.6.7, but 5.6.8 seems to do some things differently again.

  11. bording commented on Apr 21, 2021

    @bording
    Contributor

    I have opened #2669 with my attempt to fix this problem.

  12. arturcic commented on Apr 28, 2021

    @arturcic
    Member

    Closed by #2669

  13. added this to the 5.6.9 milestone on Apr 28, 2021
  14. github-actions commented on Apr 29, 2021

    @github-actions

    🎉 This issue has been resolved in version 5.6.9 🎉
    The release is available on:

    Your GitReleaseManager bot 📦🚀

  15. SeppPenner commented on Apr 29, 2021

    @SeppPenner

    Nice work, I can confirm that the issue is now solved 👍

  16. arturcic commented on Apr 29, 2021

    @arturcic
    Member

    We should thank @bording for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions