[BUG] Segfault when all runs of a Complexity() benchmark are skipped
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- cpp
- Área
- performance, testing
Línea de trabajo
Empieza por BenchmarkRunner::DoOneRepetition y RunBenchmarks, mencionados en la explicación del issue sobre el fallo con Runs vacío. Reproduce el fallo con el programa proporcionado usando Complexity() y ejecuciones omitidas. Después, revisa las pruebas de benchmarks para encontrar el lugar adecuado donde añadir el caso de regresión. Se habrá terminado cuando se informen todas las ejecuciones omitidas, se sigan ejecutando los benchmarks posteriores y no aparezcan filas de BigO ni RMS.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
If every run of a benchmark family using Complexity() is skipped, with either SkipWithMessage or SkipWithError, RunSpecifiedBenchmarks() segfaults. The remaining results are lost, and any later benchmarks don't run. The same benchmark without Complexity() exits normally.
System
- OS: macOS 26.6.2 (arm64)
- Compiler and version: Apple clang 21.0.0 (clang-2100.3.34.2)
To reproduce
- Sync to commit e508a65 (
main) and build in Release mode. - Compile and run this program, linked against the library:
#include <benchmark/benchmark.h>
static void BM_Sort(benchmark::State& state) {
state.SkipWithMessage("not supported on this machine");
for (auto _ : state) {
}
state.SetComplexityN(state.range(0));
}
BENCHMARK(BM_Sort)->Range(8, 64)->Complexity();
BENCHMARK_MAIN();
- It prints the
BM_Sort/8row, then exits with a segfault (exit code 139) before printingBM_Sort/64.
Expected behavior
Both runs are reported as skipped, no BigO or RMS rows are printed, and the program exits normally.
Additional context
BenchmarkRunner::DoOneRepetition counts skipped runs in num_runs_done, but only adds non-skipped runs to Runs. When every run in a family is skipped, Runs is empty once the family finishes, and RunBenchmarks still calls reports_for_family->Runs.front().family_index. UBSan reports a reference binding to a null pointer there.
The same code is in v1.10.0, though I only ran the reproducer on main.
I'd like to work on this. I have a fix that takes the family index from the benchmark instance, plus a regression test, and can open a PR.
- Lenguaje dominante
- C++
- Estrellas
- 10.5k
- Forks
- 1.8k
- Merge medio
- 2 d 2 h
- PR fusionados (30 d)
- 31
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 google/benchmark
-
[BUG] Confusing title in docs/platform_specific_build_instructions.mdPosiblemente ocupada @skryabae la tomó hace 27 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
[BUG] Memory manager counts allocations not part of benchmarkQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
google/benchmark#2149 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
Three small hardening notes from a security review: CSV formula-prefix neutralization, full C0 escaping in the JSON reporter, and type diagnostics in gbench/compare.pyPosiblemente ocupada @Aryan9891 la tomó hace 5 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 64/100
google/benchmark#2299 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[FR] Add native Zig bindings via top-level `bindings/zig`Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 42/100
google/benchmark#2266 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
google/benchmark#2235 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de google/benchmark
Issues similares
-
bug libcudf
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
level/task module/cloud monitoring type/maintenance
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 78/100
LadybirdBrowser/ladybird#13809 ·
Los mantenedores suelen responder en 1 día
-
bug module:nodes tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
rocketride-org/rocketride-server#3020 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 9 días