Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

storage: MSan use-after-dtor flake at exit in tests calling EnableGrpcMetricsImpl

Offen
#16,587 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@kalragauri arbeitet bereits daran.

Seit 23.10.2026.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

api: storage type: bug
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.FindMeterProviderAfterEnable
    • GrpcMetricsExporter.ConcurrentEnableFindsSameProvider
Root Cause
  1. EnableGrpcMetricsImpl() creates an OpenTelemetry MeterProvider with a PeriodicExportingMetricReader background thread (DoBackgroundWork()) and intentionally retains it in two process-lifetime singletons that are never destroyed at exit (ExporterRegistry::Singleton() and gRPC's global OpenTelemetryPluginBuilder::BuildAndRegisterGlobal()).
  2. In opentelemetry-cpp 1.24.0, PeriodicExportingMetricReader::DoBackgroundWork() runs its first CollectAndExportOnce() immediately when the worker thread starts.
  3. Instruments without a custom AggregationConfig (such as the gRPC WRR/xDS/RLS counters and gauges) use AggregationConfig::GetOrDefault(), which returns a pointer to a function-local static const AggregationConfig default_config{} (and ViewRegistry::FindViews() uses static const View view("")).
  4. When the unit test binary finishes main() and calls exit(), __cxa_atexit runs AggregationConfig::~AggregationConfig() on default_config (which MSan poisons via __sanitizer_dtor_callback_fields), while the leaked PeriodicExportingMetricReader background thread is concurrently executing SyncMetricStorage::Collect() and reading aggregation_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
Vorherrschende Sprache
C++
Sterne
659
Forks
475
Ø Merge
1 T. 12 Std.
Gemergte PRs (30 T.)
77

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus googleapis/google-cloud-cpp

Alle Issues in googleapis/google-cloud-cpp

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.