[BUG] Memory leak: failing `Indexer::new` → the progress payload is never freed
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 62/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- devtools
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Rust
- Estrellas
- 2.1k
- Forks
- 470
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 18
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rust-lang/git2-rs
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
`stash_foreach` crashes on stash entries with no message or a non-UTF-8 messagePosiblemente ocupada @shivampwm2020 la tomó hace 43 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
Todos los issues de rust-lang/git2-rs
Issues similares
-
bug P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Windows microphone listing treats words in a device name as DirectShow labelsPosiblemente ocupada @Sujal-chaudhary la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
clipy-recorder/clipy#447 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
nightly-cleanup
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
max-sixty/worktrunk#4939 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
[Flaky Test] tests::signer::v0::miner_recovers_when_broadcast_block_delay_across_tenures_occursAbiertoflaky
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
stacks-network/stacks-core#7918 · 1 comentario ·
Los mantenedores suelen responder en 2 días