[BUG] Memory leak: failing `Indexer::new` → the progress payload is never freed
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- devtools
Hướng nghiên cứu
The leak is the OdbPackwriterCb box allocated in Indexer::new_ext, which the sanitizer report places in the git2 crate's indexer and odb modules. Start by reading how new_ext builds the callback and what happens on the error return path when the libgit2 indexer creation fails. Run the reproduction under AddressSanitizer. Done means the error is still returned for a nonexistent directory and the LeakSanitizer report no longer appears.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Can be triggered on the latest commit b9d59b6 (git2, vendored-libgit2 feature), from rust safe code (#![forbid(unsafe_code)]).
Summary
Running the program below prints the following and exits with a LeakSanitizer report:
indexer -> Some(Error { code: -1, klass: 2, message: "failed to create temporary file '/nonexistent/git2-idx/pack_git2_58c30172ca8189b1': No such file or directory" })
==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#5 <alloc::boxed::Box<git2::odb::OdbPackwriterCb>>::new
#6 <git2::indexer::Indexer>::new_ext
#7 <git2::indexer::Indexer>::new
SUMMARY: AddressSanitizer: 16 byte(s) leaked in 1 allocation(s).
Indexer::new returns Err when given a nonexistent output directory, leaving the 16-byte OdbPackwriterCb allocated during Indexer::new leaked at exit.
Reproduce
Cargo.toml:
[dependencies]
git2 = { git = "https://github.com/rust-lang/git2-rs", rev = "b9d59b6", features = ["vendored-libgit2"] }
src/main.rs:
#![forbid(unsafe_code)]
use git2::Indexer;
use std::path::Path;
fn main() {
let r = Indexer::new(None, Path::new("/nonexistent/git2-idx"), 0, false);
eprintln!("indexer -> {:?}", r.err());
}
RUSTFLAGS="-Zsanitizer=address" \
cargo +nightly run -Zbuild-std --target x86_64-unknown-linux-gnu
- Ngôn ngữ chính
- Rust
- Star
- 2.1k
- Fork
- 470
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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 rust-lang/git2-rs
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 messageCó thể đã có người làm @shivampwm2020 đã nhận 43 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rust-lang/git2-rs
Issue tương tự
-
bug P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Windows microphone listing treats words in a device name as DirectShow labelsCó thể đã có người làm @Sujal-chaudhary đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
clipy-recorder/clipy#447 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
nightly-cleanup
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
max-sixty/worktrunk#4939 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursĐang mởflaky
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
stacks-network/stacks-core#7918 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày