PackWriter produces duplicate objects in pack during bitmap walk with index misses

未關閉
#314 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
22/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
git, java
領域
devtools

研究方向

Start with BitmapIndexImpl.CompressedBitmap.iterator(), which yields ObjectIds from the mutableIndex range and the ofObjectType range, then check how PackWriter.addObject() adds them through ObjectIdOwnerMap.add() without a duplicate check. Reproduce on a repository with low bitmap coverage and midx bitmaps enabled. Done means a test shows each object written once and a clone or fetch of that repository succeeds.

由索引模型根據 Issue 內容生成。

描述

Version

7.7.1

Operating System

Linux/Unix

Bug description

When BitmapIndexImpl.CompressedBitmap.iterator() is used during a
bitmap walk with index misses (i.e. commits without precomputed
bitmaps that require RevWalk fallback), the same ObjectId can be
yielded twice: once from the mutableIndex range (position >=
indexObjectCount) and once from the ofObjectType range (position <
indexObjectCount).

PackWriter.addObject() inserts into objectsLists and objectsMap via
ObjectIdOwnerMap.add(), which does not check for duplicates. The
duplicate entry causes the object to be written to the pack twice.

This is reproducible on any repository where bitmap coverage is low
(e.g. an old repo with few selected commits in the bitmap) and midx
bitmap is enabled.

Actual behavior

The client fails with:

fatal: The same object appears twice in the pack
fatal: fetch-pack: invalid index-pack output

Clone/fetch is completely broken for the affected repository. 100%
reproducible, not a race condition.

Expected behavior

Clone/fetch should succeed. Each object should appear exactly once in
the pack regardless of bitmap coverage ratio.

Relevant log output
fatal: The same object 0021f932ac4d99e56d888832f024feee6318f1ad appears twice in the pack
fatal: fetch-pack: invalid index-pack output
Other information

No response

主要語言
Java
星號
427
分支
116
PR 合併指標
30 天內沒有已合併 PR

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

eclipse-jgit/jgit 的其他 Issue

查看 eclipse-jgit/jgit 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。