Fetch protocol locking order is unsafe
@barbasa đang làm issue này rồi.
Từ ngày 23/4/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Version
v7.4.0.202509020913-r
Operating System
MacOS, Linux
Bug description
When performing a forced fetch operation using FetchProcess.execute(), the fetch is supposed to lock the local ref until the fetch completes.
Locking the local ref is paramount because it would risk losing or overwriting any ref updates that occur locally whilst the fetch operation is in progress.
For detecting local modifications since the start of the fetch, the FetchProcess.want() reads the local ref at the time of the fetch and stores it into the expected object ID of the ref-update.
The ref-update upon completion checks whether the local ref has changed and, if so, returns a LOCK_FAILURE error, aborting the operation.
Actual behavior
- Start a
FetchProcess.execute()of a remote refrefs/heads/remotefoo(value=2) into a local refrefs/heads/localfoo(value=1) - Update the local ref
refs/heads/localfooo(value=3) - Wait for the
FetchProcess.execute()to finish
What I see is that depending on when step 2. happens in the middle of the FetchProcess.execute(), the FetchProcess.execute() may succeed and point to value = 2.
Expected behavior
After step 3, the FetchProcess.execute() should fail with a LOCK_FAILURE and the refs/heads/localfoo should have the value=3, which is the update at step 2 that won the race.
The modification happens during the execution of the command and shouldn't silently overwrite the destination ref depending on the concurrency and timing of the local operation.
Relevant log output
Other information
I believe the problem is in the sequence of the logical locking of the refs/heads/localfoo.
The fetch of the refs/heads/localfoo happens in the want(Ref src, RefSpec spec) function, when the remote ref and its value have already been fetched; however, things may have changed because nothing was locked before then.
If the local ref-update occurs after the execution of want(Ref src, RefSpec spec), it is detected, but any prior modification would go unnoticed and therefore could be lost or overwritten.
- Ngôn ngữ chính
- Java
- Star
- 427
- Fork
- 116
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của eclipse-jgit/jgit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
eclipse-jgit/jgit#329 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
eclipse-jgit/jgit#327 ·
-
Repository.create(boolean bare) should provide a no-arg overload that uses isBare()Có thể làm lại được @hardikyadav12 đã nhận 77 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
eclipse-jgit/jgit#297 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
eclipse-jgit/jgit#293 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
eclipse-jgit/jgit#288 ·
Tất cả issue của eclipse-jgit/jgit
Issue tương tự
-
? - Needs Triage bot_watch bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NVIDIA/cudf-spark-jni#5594 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Upgrade solr to 9.11.0Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DataONEorg/dataone-indexer#390 ·