Gitversion: StackoverflowException when using msbuild in VS2017 in 4.0.0-beta11

Created on 26 Mar 2017  路  3Comments  路  Source: GitTools/GitVersion

I am seeing a stackoverflow crash when I try to build a branch that has just been merged with changes from dev (parent) branch.

Some portion of the log is

     3>MSBUILD : warning :
                                   WARN [03/26/17 3:30:04:52] Failed to inherit Increment branch configuration, no bran
       ches found.\r [C:\git\msal-dotnet\src\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj]
MSBUILD : warning : \r [C:\git\msal-dotnet\src\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj]
       MSBUILD : warning : Falling back to origin/master branch config [C:\git\msal-dotnet\src\Microsoft.Identity.Clien
       t\Microsoft.Identity.Client.csproj]

                   INFO [03/26/17 3:30:04:52] No branch configuration found for branch origin/master, falling back to d
         efault configuration

                   INFO [03/26/17 3:30:04:52] Begin: Attempting to inherit branch configuration from parent branch

                     INFO [03/26/17 3:30:04:52] HEAD is merge commit, this is likely a pull request using dev as base

                     INFO [03/26/17 3:30:04:52] Begin: Finding branch source of 'dev'

                     INFO [03/26/17 3:30:04:52] End: Finding branch source of 'dev' (Took: 0.00ms)

                     INFO [03/26/17 3:30:04:52] Begin: Getting branches containing the commit '923177e62783491c8d9fc47e
         a476b5226d70a5b3'.

                       INFO [03/26/17 3:30:04:52] Trying to find direct branches.

                       INFO [03/26/17 3:30:04:52] No direct branches found, searching through tracked branches.

                     INFO [03/26/17 3:30:04:53] End: Getting branches containing the commit '923177e62783491c8d9fc47ea4
         76b5226d70a5b3'. (Took: 1.00ms)

                     INFO [03/26/17 3:30:04:53] Found possible parent branches:
     3>MSBUILD : warning :
                                     WARN [03/26/17 3:30:04:53] Failed to inherit Increment branch configuration, no br
       anches found.\r [C:\git\msal-dotnet\src\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj]
MSBUILD : warning : \r [C:\git\msal-dotnet\src\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj]
       MSBUILD : warning : Falling back to origin/master branch config [C:\git\msal-dotnet\src\Microsoft.Identity.Clien
       t\Microsoft.Identity.Client.csproj]

                     INFO [03/26/17 3:30:04:53] No branch configuration found for branch origin/master, falling back to
          default configuration

                     INFO [03/26/17 3:30:04:53] Begin: Attempting to inherit branch configuration from parent branch

                       INFO [03/26/17 3:30:04:53] HEAD is merge commit, this is likely a pull request using dev as base

                       INFO [03/26/17 3:30:04:53] Begin: Finding branch source of 'dev'

                       INFO [03/26/17 3:30:04:53] End: Finding branch source of 'dev' (Took: 1.00ms)

                       INFO [03/26/17 3:30:04:53] Begin: Getting branches containing the commit '923177e62783491c8d9fc4
         7ea476b5226d70a5b3'.

                         INFO [03/26/17 3:30:04:53] Trying to find direct branches.

                         INFO [03/26/17 3:30:04:53] No direct branches found, searching through tracked branches.

                       INFO [03/26/17 3:30:04:53] End: Getting branches containing the commit '923177e62783491c8d9fc47e
         a476b5226d70a5b3'. (Took: 0.00ms)

                       INFO [03/26/17 3:30:04:53] Found possible parent branches:
     3>MSBUILD : warning :
                                       WARN [03/26/17 3:30:04:54] Failed to inherit Increment branch configuration, no
       branches found.\r [C:\git\msal-dotnet\src\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj]
MSBUILD : warning : \r [C:\git\msal-dotnet\src\Microsoft.Identity.Client\Microsoft.Identity.Client.csproj]
       MSBUILD : warning : Falling back to origin/master branch config [C:\git\msal-dotnet\src\Microsoft.Identity.Clien
       t\Microsoft.Identity.Client.csproj]

Process is terminated due to StackOverflowException.

For repro, you can use https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/tree/kpanwar/client-info-67 branch.

All 3 comments

We are experiencing what appears to be the same issue. We are using a Gitflow workflow in ContinuousDeployment mode for our feature branches and doing pull request review/merge commits using BitBucket.

Steps to reproduce using GitVersion 4 beta 12:

  1. Create a feature branch (feature-123) off develop.
  2. Create a task branch (task-1) off the feature branch.
  3. Commit to the task branch.
  4. Push the task branch.
  5. Create a PR on BitBucket targeting the feature branch and merge using merge commit.
  6. Checkout the feature branch.
  7. Run GitVersion and see the version OK.
  8. Do a git pull to get the merged task branch.
  9. Run GitVersion and after a little while a StackOverflowException occurs.
  10. Delete the local task branch with git branch -d task-1,
  11. Run GitVersion and see the new version OK.

From a GitVersion /diag before deleting the merged local branch it appears the local task branch is confusing GitVersion. First I notice that it was unable to find possible parent branches:

  INFO [11/14/17 20:33:53:21] Found possible parent branches:
  WARN [11/14/17 20:33:53:22] Failed to inherit Increment branch configuration, no branches found.

Next it then gets stuck in a recursive loop doing the following until it crashes with :

Falling back to develop branch config
  INFO [11/14/17 20:33:53:22] Begin: Attempting to inherit branch configuration from parent branch
    INFO [11/14/17 20:33:53:22] HEAD is merge commit, this is likely a pull request using task-1 as base
    INFO [11/14/17 20:33:53:22] Begin: Finding branch source of 'task-1'
    INFO [11/14/17 20:33:53:22] End: Finding branch source of 'task-1' (Took: 1.97ms)
    INFO [11/14/17 20:33:53:22] Begin: Getting branches containing the commit 'c9233d7fa3d7d565d7fe418764641e5c50caa041'.
      INFO [11/14/17 20:33:53:22] Trying to find direct branches.
      INFO [11/14/17 20:33:53:22] No direct branches found, searching through tracked branches.
    INFO [11/14/17 20:33:53:22] End: Getting branches containing the commit 'c9233d7fa3d7d565d7fe418764641e5c50caa041'. (Took: 2.00ms)
    INFO [11/14/17 20:33:53:22] Found possible parent branches:
    WARN [11/14/17 20:33:53:22] Failed to inherit Increment branch configuration, no branches found.

I just hit this, the next part of the logs is interesting, I think this got added after your investigation @CraigN

[15:55:32][Step 2/2]                     WARN [12/04/17 7:55:32:33] Failed to inherit Increment branch configuration, no branches found.
[15:55:32][Step 2/2] 
[15:55:32][Step 2/2] Falling back to origin/master branch config
[15:55:32][Step 2/2]                     INFO [12/04/17 7:55:32:33] No branch configuration found for branch origin/master, falling back to default configuration
[15:55:32][Step 2/2]                     INFO [12/04/17 7:55:32:33] Begin: Attempting to inherit branch configuration from parent branch

The root cause is private const IncrementStrategy DefaultIncrementStrategy = IncrementStrategy.Inherit;

We fall back to that, which then starts looking again...

I actually don't know how my build server is hitting this, we really need to kill branch normalisation because it makes it impossible to debug. BUT I think there is another fix, when building the PR merge result, if we use the PR HEAD instead of the merge result we should be able to calculate the correct config. Going to put up a PR

This is not fixed in 5.0.0

Was this page helpful?
0 / 5 - 0 ratings