Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Devops build: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. #4264

Open
2 tasks done
ulluoink opened this issue Oct 16, 2024 · 3 comments

Comments

@ulluoink
Copy link

ulluoink commented Oct 16, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.Tool

GitVersion version

6.0.3

Operating system

Windows

What are you seeing?

following exception is thrown every time Gitversion is executed.

the Exceptions began with version 6.0.3

ERROR [24-10-15 11:11:33:93] An unexpected error occurred:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.String.Ctor(SByte* value, Int32 startIndex, Int32 length, Encoding enc)
   at LibGit2Sharp.Core.EncodingMarshaler.FromNative(Encoding encoding, Byte* pNativeData) in /_/LibGit2Sharp/Core/EncodingMarshaler.cs:line 120
   at LibGit2Sharp.Signature..ctor(git_signature* sig) in /_/LibGit2Sharp/Signature.cs:line 22
   at LibGit2Sharp.Core.Proxy.git_commit_author(ObjectHandle obj) in /_/LibGit2Sharp/Core/Proxy.cs:line 289
   at LibGit2Sharp.Core.LazyGroup`1.Dependent`2.LibGit2Sharp.Core.LazyGroup<T>.IEvaluator<TInput>.Evaluate(TInput input) in /_/LibGit2Sharp/Core/LazyGroup.cs:line 93
   at LibGit2Sharp.Core.LazyGroup`1.<Evaluate>b__6_0(T input) in /_/LibGit2Sharp/Core/LazyGroup.cs:line 37
   at LibGit2Sharp.Core.GitObjectLazyGroup.EvaluateInternal(Action`1 evaluator) in /_/LibGit2Sharp/Core/GitObjectLazyGroup.cs:line 19
   at LibGit2Sharp.Core.LazyGroup`1.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 35
   at GitVersion.Git.Commit..ctor(Commit innerCommit) in /_/src/GitVersion.LibGit2Sharp/Git/Commit.cs:line 18
   at System.Linq.Enumerable.SelectEnumerableIterator`2.ToArray()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at GitVersion.Git.CommitCollection.GetEnumerator() in /_/src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs:line 18
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at GitVersion.RepositoryStore.GetSourceBranches(IBranch branch, IGitVersionConfiguration configuration, IEnumerable`1 excludedBranches)+MoveNext() in /_/src/GitVersion.Core/Core/RepositoryStore.cs:line 139
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at GitVersion.VersionCalculation.EffectiveBranchConfigurationFinder.GetEffectiveConfigurationsRecursive(IBranch branch, IGitVersionConfiguration configuration, IBranchConfiguration childBranchConfiguration, HashSet`1 traversedBranches)+MoveNext() in /_/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs:line 37
   at GitVersion.VersionCalculation.EffectiveBranchConfigurationFinder.GetEffectiveConfigurationsRecursive(IBranch branch, IGitVersionConfiguration configuration, IBranchConfiguration childBranchConfiguration, HashSet`1 traversedBranches)+MoveNext() in /_/src/GitVersion.Core/VersionCalculation/EffectiveBranchConfigurationFinder.cs:line 56
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at GitVersion.VersionCalculation.NextVersionCalculator.<>c__DisplayClass14_0.<<GetNextVersions>g__GetNextVersionsInternal|0>d.MoveNext() in /_/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs:line 244
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GitVersion.VersionCalculation.NextVersionCalculator.GetNextVersions(IBranch branch, IGitVersionConfiguration configuration) in /_/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs:line 239
   at GitVersion.VersionCalculation.NextVersionCalculator.CalculateNextVersion(IBranch branch, IGitVersionConfiguration configuration) in /_/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs:line 158
   at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in /_/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs:line 53
   at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in /_/src/GitVersion.Core/Core/GitVersionCalculateTool.cs:line 45
   at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in /_/src/GitVersion.App/GitVersionExecutor.cs:line 66

What is expected?

should not throw exception and should work as expected ^^

Steps to Reproduce

dotnet tool install GitVersion.Tool --version 6.* --create-manifest-if-needed
dotnet tool restore
dotnet dotnet-gitversion /config $ConfigFilePath /output buildserver

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

No response

@ulluoink ulluoink changed the title System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. Azure Devops build: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. Oct 16, 2024
@arturcic
Copy link
Member

We need a Git Repository to check with, please provide some steps to reproduce as the exception is not enough for investigation

@ulluoink
Copy link
Author

i am of course not allowed to share oine of our repositories.

it happens everytime we execute the given commands (see above) in each repository we use.

it happens since yesterday when 6.0.3 was published and since the step is using 6.0.3

what more info do you need?

@asbjornu
Copy link
Member

asbjornu commented Oct 16, 2024

As you can see from the stack trace, the problem occurs in LibGit2Sharp. The stack trace is:

  1. EncodingMarshaler.cs:120
  2. Signature.cs:22
  3. Proxy.cs:289

Which indicates that there's a commit with an author name so large it can't be unmarshalled from its native pointer into a C# System.String. I would consider this a bug in LibGit2Sharp, as it shouldn't crash on anything that doesn't crash libgit2 itself, but I can see why such a large author name isn't expected and therefore not handled more gracefully.

@ulluoink, I would recommend that you go through the commits and inspect what author name may be the culprit here. Perhaps you can ignore the bad commits so GitVersion doesn't try to instantiate them through LibGit2Sharp, or amend them with Git itself so they become instantiable. Either way, this is a problem outside the scope of GitVersion and either has to be fixed in the repository itself or in LibGit2Sharp.

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

No branches or pull requests

3 participants