[BUG] Memory leak: failing `Indexer::new` → the progress payload is never freed
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 62/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- devtools
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Rust
- Stelle
- 2.1k
- Fork
- 470
- Merge medio
- 2g 17h
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rust-lang/git2-rs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 messageForse già presa @shivampwm2020 l’ha presa 43 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rust-lang/git2-rs
Issue simili
-
bug P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Windows microphone listing treats words in a device name as DirectShow labelsForse già presa @Sujal-chaudhary l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
clipy-recorder/clipy#447 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
nightly-cleanup
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
max-sixty/worktrunk#4939 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursApertaflaky
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
stacks-network/stacks-core#7918 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni