-
Notifications
You must be signed in to change notification settings - Fork 501
Description
There is a potential use-after-free bug in the OpenTelemetry C++ SDK metrics implementation.
Problem:
-
Metric storage class(
SyncMetricStorage
) store a raw pointer to the AttributesProcessor instance, which is owned by the associated View. -
The View (and its
AttributesProcessor
) is owned by theViewRegistry
, which is managed by theMeterContext
and ultimately theMeterProvider
. -
When the
MeterProvider
is shut down or destroyed, theViewRegistry
and itsView
s are deleted, invalidating theAttributesProcessor
pointer inside any metric storage objects. -
If metric instruments are recorded after shutdown (especially from other threads, background tasks, or due to application logic errors), this leads to use-after-free, undefined behavior, and possible segmentation faults.