storage: MSan use-after-dtor flake at exit in tests calling EnableGrpcMetricsImpl
Los mantenedores suelen responder en 1 día
@kalragauri ya está trabajando en esto.
Desde el 23/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Description
Unit tests introduced in #16538 that call storage_internal::EnableGrpcMetricsImpl() are flaky under MemorySanitizer (msan-ci and msan-storage-ci), failing at process exit with a use-of-uninitialized-value (use-after-dtor) error:
//google/cloud/storage:internal_grpc_channel_metrics_test:ChannelMetrics.RegisteredAuthorityHonorsOption
//google/cloud/storage:internal_grpc_metrics_exporter_impl_test:GrpcMetricsExporter.FindMeterProviderAfterEnableGrpcMetricsExporter.ConcurrentEnableFindsSameProvider
Root Cause
EnableGrpcMetricsImpl()creates an OpenTelemetryMeterProviderwith aPeriodicExportingMetricReaderbackground thread (DoBackgroundWork()) and intentionally retains it in two process-lifetime singletons that are never destroyed at exit (ExporterRegistry::Singleton()and gRPC's globalOpenTelemetryPluginBuilder::BuildAndRegisterGlobal()).- In
opentelemetry-cpp1.24.0,PeriodicExportingMetricReader::DoBackgroundWork()runs its firstCollectAndExportOnce()immediately when the worker thread starts. - Instruments without a custom
AggregationConfig(such as the gRPC WRR/xDS/RLS counters and gauges) useAggregationConfig::GetOrDefault(), which returns a pointer to a function-localstatic const AggregationConfig default_config{}(andViewRegistry::FindViews()usesstatic const View view("")). - When the unit test binary finishes
main()and callsexit(),__cxa_atexitrunsAggregationConfig::~AggregationConfig()ondefault_config(which MSan poisons via__sanitizer_dtor_callback_fields), while the leakedPeriodicExportingMetricReaderbackground thread is concurrently executingSyncMetricStorage::Collect()and readingaggregation_config_->cardinality_limit_.
Example Stack Trace
==12==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x7ff25512eae8 in opentelemetry::v1::sdk::metrics::AttributesHashMapWithCustomHash<opentelemetry::v1::sdk::metrics::FilteredOrderedAttributeMapHash>::AttributesHashMapWithCustomHash(unsigned long) .../opentelemetry/sdk/metrics/state/attributes_hashmap.h:53:9
#1 0x7ff25512eae8 in opentelemetry::v1::sdk::metrics::SyncMetricStorage::Collect(...) .../external/opentelemetry-cpp+/sdk/src/metrics/state/sync_metric_storage.cc:39:35
#2 0x7ff2550d38fe in opentelemetry::v1::sdk::metrics::Meter::Collect(...) .../external/opentelemetry-cpp+/sdk/src/metrics/meter.cc:661:28
...
#10 0x7ff255080e64 in opentelemetry::v1::sdk::metrics::PeriodicExportingMetricReader::CollectAndExportOnce() .../external/opentelemetry-cpp+/sdk/src/metrics/export/periodic_exporting_metric_reader.cc:172:11
#11 0x7ff255080e64 in opentelemetry::v1::sdk::metrics::PeriodicExportingMetricReader::DoBackgroundWork() .../external/opentelemetry-cpp+/sdk/src/metrics/export/periodic_exporting_metric_reader.cc:107:19
Member fields were destroyed
#0 0x492ed1 in __sanitizer_dtor_callback_fields
#1 0x7ff257252416 in opentelemetry::v1::sdk::metrics::AggregationConfig::~AggregationConfig() .../opentelemetry/sdk/metrics/aggregation/aggregation_config.h:37:10
#3 0x4938bf in MSanCxaAtExitWrapper(void*)
#4 0x7ff24dd6e70d in exit
Example CI Builds
- Lenguaje dominante
- C++
- Estrellas
- 659
- Forks
- 475
- Merge medio
- 1 d 12 h
- PR fusionados (30 d)
- 77
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 googleapis/google-cloud-cpp
-
cleanup(storage): remove deprecated OpenTelemetry rpc.message.type and rpc.message.id attributesAbiertoapi: storage type: cleanup
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
googleapis/google-cloud-cpp#16544 ·
Los mantenedores suelen responder en 1 día
-
api: storage priority: p2 type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
googleapis/google-cloud-cpp#16529 ·
Los mantenedores suelen responder en 1 día
-
type: feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
googleapis/google-cloud-cpp#16193 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
googleapis/google-cloud-cpp#16575 ·
Los mantenedores suelen responder en 1 día
-
api: storage type: cleanup
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
googleapis/google-cloud-cpp#16545 ·
Los mantenedores suelen responder en 1 día
Todos los issues de googleapis/google-cloud-cpp
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
aristocratos/btop#1945 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
boykopovar/AnyPS5#11291 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
k2-fsa/sherpa-onnx#4100 ·
Los mantenedores suelen responder en 2 días
-
Eval bug: Vulkan: count_experts.comp zero_skipped_rows() loops over every id in every threadAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Mod: Part Design Topic: User Interface
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día