libgit2 / libgit2/libgit2sharp

AccessViolationException accessing Commit.Parents concurrently on Linux .NET 10

オープン
#2,192 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
C#
スター
3.5k
フォーク
925
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、リンク先の Ubuntu 24.04 GitHub Actions ジョブで VersionOracleTests.CloudBuildNumber_4thPosition を再現し、次に Commit.Parents に並行してアクセスしている TryCalculateHeight を調べます。一時的に直列化したテストコレクションでの動作と比較し、独立したリポジトリ操作がサポートされているかどうかを判断します。原因を文書化し、現在のパッケージバージョン向けの確認済みの修正またはガイダンスを提供できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, git
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
説明が足りない
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。