libgit2 / libgit2/libgit2sharp

AccessViolationException accessing Commit.Parents concurrently on Linux .NET 10

Ouverte
#2,192 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
C#
Étoiles
3.5k
Forks
925
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Environment

  • LibGit2Sharp 0.32.0
  • LibGit2Sharp.NativeBinaries 2.0.324 (libgit2 1.8.6)
  • .NET SDK/runtime 10.0.400
  • Linux x64, GitHub-hosted Ubuntu 24.04 runner

Failure

A test process intermittently terminates with System.AccessViolationException while accessing Commit.Parents during a version-height calculation. The test uses distinct temporary repositories per test instance, and the LibGit2Context and its Repository are both live and strongly referenced throughout the failing call.

The latest occurrence is in this public GitHub Actions job:
https://github.com/dotnet/Nerdbank.GitVersioning/actions/runs/33464845055/job/99722455984

Relevant managed stack:

System.AccessViolationException: Attempted to read or write protected memory.
   at Nerdbank.GitVersioning.LibGit2.LibGit2GitExtensions.<GetCommitHeight>g__TryCalculateHeight|19_0(LibGit2Sharp.Commit, <>c__DisplayClass19_0 ByRef)
   at Nerdbank.GitVersioning.LibGit2.LibGit2GitExtensions.GetCommitHeight(LibGit2Sharp.Commit, GitWalkTracker, Func<Commit, Boolean>)
   at Nerdbank.GitVersioning.LibGit2.LibGit2GitExtensions.GetVersionHeight(LibGit2Context, Version)
   at Nerdbank.GitVersioning.LibGit2.LibGit2Context.CalculateVersionHeight(VersionOptions, VersionOptions)
   at Nerdbank.GitVersioning.VersionOracle..ctor(GitContext, ICloudBuild, Nullable<Int32>)
   at VersionOracleTests.CloudBuildNumber_4thPosition(...)

TryCalculateHeight is walking commit.Parents; this theory does not configure path filters, so it does not call Diff.Compare.

Investigation

We found and fixed separate repository-local lifetime defects where a lazy commit query escaped its context and a VersionOracle retained a disposed context. This crash persists after those fixes, and the present stack has no escaped lazy sequence or disposed native owner.

The test assembly's normal xUnit test-collection parallelism is the remaining variable. We are temporarily serializing test collections to prevent the intermittent native process crash, but would prefer a LibGit2Sharp/libgit2 fix or guidance about concurrent independent repository operations on Linux/.NET 10.

Related historical reports include #988 and #1513, but this report targets the current package versions and live-context Commit.Parents failure.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire VersionOracleTests.CloudBuildNumber_4thPosition dans le job Ubuntu 24.04 GitHub Actions lié, puis examinez TryCalculateHeight, où Commit.Parents est accédé de manière concurrente. Comparez le comportement avec les collections de tests temporairement sérialisées et déterminez si les opérations indépendantes sur le dépôt sont prises en charge ; le travail est terminé lorsque la cause est documentée et qu’un correctif confirmé ou des indications pour les versions actuelles du package sont fournis.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, git
Domaine
devtools
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
À clarifier
Accessibilité débutants
38/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.