libgit2 / libgit2/libgit2sharp
AccessViolationException accessing Commit.Parents concurrently on Linux .NET 10
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C#
- Sterne
- 3.5k
- Forks
- 925
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, VersionOracleTests.CloudBuildNumber_4thPosition im verlinkten Ubuntu 24.04 GitHub Actions-Job zu reproduzieren, und untersuche anschließend TryCalculateHeight, wo gleichzeitig auf Commit.Parents zugegriffen wird. Vergleiche das Verhalten mit den temporären serialisierten Test-Sammlungen und ermittle, ob unabhängige Repository-Operationen unterstützt werden; abgeschlossen ist die Aufgabe, wenn die Ursache dokumentiert und ein bestätigter Fix oder eine Anleitung für die aktuellen Paketversionen bereitgestellt wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- csharp, git
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 38/100