Repository navigation
[OpenTelemetry] Fix race initializing AggregatorStore on ARM64 - #7951
Merged
martincostello merged 6 commits intoOct 16, 2026
Merged
martincostello merged 6 commits into
martincostello merged 6 commits into
Conversation
Pull request dashboard statusMerged · refreshed 2026-10-16 10:24 UTC Status above doesn't look right?
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7951 +/- ##
=======================================
Coverage 92.30% 92.30%
=======================================
Files 363 363
Lines 21035 21035
=======================================
Hits 19416 19416
Misses 1619 1619
Flags with carried forward coverage won't be shown. Click here to find out more.
|
martincostello
approved these changes
Oct 16, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused volatile-publication fix includes concurrent-path coverage and a changelog entry, with no unresolved findings.
0 open findings
What changed in this PR
Fixes ARM64 memory-ordering risks when the metrics SDK initializes reserved metric points.
Changes:
- Makes both initialization flags
volatile. - Adds concurrent first-measurement coverage for untagged and overflow points.
- Documents the fix in the SDK changelog.
| File | Description |
|---|---|
| test/OpenTelemetry.Tests/Metrics/MetricPointReclaimTests.cs | Tests concurrent initialization of reserved points. |
| src/OpenTelemetry/Metrics/AggregatorStore.cs | Uses volatile flags to safely publish initialization. |
| src/OpenTelemetry/CHANGELOG.md | Records the ARM64 race fix. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
matt-hensley
marked this pull request as ready for review
October 16, 2026 09:32
This was referenced Oct 24, 2026
Merged
intellitect-bot
pushed a commit
to IntelliTect/EssentialCSharp.Web
that referenced
this pull request
Oct 25, 2026
Pinned [OpenTelemetry.Extensions.Hosting](https://github.com/open-telemetry/opentelemetry-dotnet) at 1.20.1. <details> <summary>Release notes</summary> _Sourced from [OpenTelemetry.Extensions.Hosting's releases](https://github.com/open-telemetry/opentelemetry-dotnet/releases)._ ## 1.20.1 For highlights and announcements pertaining to this release see: [Release Notes > 1.20.1](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/RELEASENOTES.md#1201). The following changes are from the previous release [1.20.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.20.0). * NuGet: [OpenTelemetry v1.20.1](https://www.nuget.org/packages/OpenTelemetry/1.20.1) * Fixed a possible race condition on ARM64 when multiple threads record the first measurement with no tags, or the first overflow measurement, that could cause the measurement to be recorded incorrectly. ([#7951](open-telemetry/opentelemetry-dotnet#7951)) * Fixed self-diagnostics preamble redaction of quoted or encoded PEM material and prefixed JWTs. ([#7955](open-telemetry/opentelemetry-dotnet#7955)) * Fixed default HTTP client log filtering when registering the OTLP log exporter through `OpenTelemetryLoggerOptions`. ([#7959](open-telemetry/opentelemetry-dotnet#7959)) * Fixed legacy self-diagnostics logging terminating the process when the log file is truncated or the log volume runs out of space. ([#7956](open-telemetry/opentelemetry-dotnet#7956)) * **Experimental (pre-release builds only):** Fixed `Logger.EmitLog` ignoring instrumentation suppression, which could cause recursive exports or deadlocks. ([#7961](open-telemetry/opentelemetry-dotnet#7961)) * Fixed delta double counters losing subsequent measurements after a non-finite or large value and idle metric points with a `NaN` value failing to be reclaimed. ([#7963](open-telemetry/opentelemetry-dotnet#7963)) * Improve the assignment of values to exponential histogram buckets when the value is near a bucket boundary by using a pre-computed lookup table. ([#7911](open-telemetry/opentelemetry-dotnet#7911)) * Fixed `LogRecord`s being returned to the shared pool while still queued for export when an exporter stops enumerating a single-item or array `Batch<LogRecord>` early which could cause a `BatchLogRecordExportProcessor` on the same provider to export missing or incorrect data. ([#7965](open-telemetry/opentelemetry-dotnet#7965)) * Fixed a `SuppressInstrumentationScope.Enter()` reference count never being released when the `Activity` it was entered for is not recorded, which caused all subsequent telemetry in that execution context to be suppressed. ([#7966](open-telemetry/opentelemetry-dotnet#7966)) * Self-diagnostics log files, whether configured through `OTEL_DIAGNOSTICS.json` or `SelfDiagnosticsOptions`, are now always created as new files. ([#7968](open-telemetry/opentelemetry-dotnet#7968)) ... (truncated) ## 1.20.1-rc.1 The following changes are from the previous release [1.20.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.20.0). * NuGet: [OpenTelemetry v1.20.1-rc.1](https://www.nuget.org/packages/OpenTelemetry/1.20.1-rc.1) * Fixed a possible race condition on ARM64 when multiple threads record the first measurement with no tags, or the first overflow measurement, that could cause the measurement to be recorded incorrectly. ([#7951](open-telemetry/opentelemetry-dotnet#7951)) * Fixed self-diagnostics preamble redaction of quoted or encoded PEM material and prefixed JWTs. ([#7955](open-telemetry/opentelemetry-dotnet#7955)) * Fixed default HTTP client log filtering when registering the OTLP log exporter through `OpenTelemetryLoggerOptions`. ([#7959](open-telemetry/opentelemetry-dotnet#7959)) * Fixed legacy self-diagnostics logging terminating the process when the log file is truncated or the log volume runs out of space. ([#7956](open-telemetry/opentelemetry-dotnet#7956)) * **Experimental (pre-release builds only):** Fixed `Logger.EmitLog` ignoring instrumentation suppression, which could cause recursive exports or deadlocks. ([#7961](open-telemetry/opentelemetry-dotnet#7961)) * Fixed delta double counters losing subsequent measurements after a non-finite or large value and idle metric points with a `NaN` value failing to be reclaimed. ([#7963](open-telemetry/opentelemetry-dotnet#7963)) * Improve the assignment of values to exponential histogram buckets when the value is near a bucket boundary by using a pre-computed lookup table. ([#7911](open-telemetry/opentelemetry-dotnet#7911)) * Fixed `LogRecord`s being returned to the shared pool while still queued for export when an exporter stops enumerating a single-item or array `Batch<LogRecord>` early which could cause a `BatchLogRecordExportProcessor` on the same provider to export missing or incorrect data. ([#7965](open-telemetry/opentelemetry-dotnet#7965)) * Fixed a `SuppressInstrumentationScope.Enter()` reference count never being released when the `Activity` it was entered for is not recorded, which caused all subsequent telemetry in that execution context to be suppressed. ([#7966](open-telemetry/opentelemetry-dotnet#7966)) * Self-diagnostics log files, whether configured through `OTEL_DIAGNOSTICS.json` or `SelfDiagnosticsOptions`, are now always created as new files. ([#7968](open-telemetry/opentelemetry-dotnet#7968)) * Self-diagnostics messages written to the sinks configured by `SelfDiagnosticsOptions` are now truncated to 16,384 characters so that the ... (truncated) ## 1.20.1-beta.1 The following changes are from the previous release [1.20.0-beta.1](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/coreunstable-1.20.0-beta.1). * NuGet: [OpenTelemetry.Exporter.Prometheus.AspNetCore v1.20.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.AspNetCore/1.20.1-beta.1) * Fixed scrape responses being handed to the server in a single write, which made the server buffer a full copy of the response for each client that did not read it until the request completed or timed out. Responses are now written in bounded slices so the server's back-pressure applies. ([#7957](open-telemetry/opentelemetry-dotnet#7957)) * Fixed startup scrapes permanently omitting `target_info` and configured resource constant labels from subsequent scrape responses. ([#7984](open-telemetry/opentelemetry-dotnet#7984)) * Updated OpenTelemetry core component version(s) to `1.20.1`. ([#7990](open-telemetry/opentelemetry-dotnet#7990)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.20.1-beta.1/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Prometheus.HttpListener v1.20.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.HttpListener/1.20.1-beta.1) * Fixed scrape responses being handed to the server in a single write, which on Linux and macOS made the listener allocate and hold a full copy of the response for each client that did not read it until the request completed or timed out. Responses are now written in bounded slices. ([#7957](open-telemetry/opentelemetry-dotnet#7957)) * Fixed scrape requests that announce a request body holding a thread pool thread after their response had been sent on Linux and macOS for as long as the client kept trickling in the body. The connection is now closed after responding to a request with a body instead of being kept alive. ([#7962](open-telemetry/opentelemetry-dotnet#7962)) * Fixed startup scrapes permanently omitting `target_info` and configured resource constant labels from subsequent scrape responses. ([#7984](open-telemetry/opentelemetry-dotnet#7984)) * Updated OpenTelemetry core component version(s) to `1.20.1`. ([#7990](open-telemetry/opentelemetry-dotnet#7990)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.20.1-beta.1/src/OpenTelemetry.Exporter.Prometheus.HttpListener/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Shims.OpenTracing v1.20.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Shims.OpenTracing/1.20.1-beta.1) * Updated OpenTelemetry core component version(s) to `1.20.1`. ([#7990](open-telemetry/opentelemetry-dotnet#7990)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.20.1-beta.1/src/OpenTelemetry.Shims.OpenTracing/CHANGELOG.md) for details. Commits viewable in [compare view](open-telemetry/opentelemetry-dotnet@core-1.20.0...core-1.20.1). </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
cyrusjamula
added a commit
to Jamula/Andreja
that referenced
this pull request
Oct 25, 2026
Updated [OpenTelemetry.Extensions.Hosting](https://github.com/open-telemetry/opentelemetry-dotnet) from 1.20.0 to 1.20.1. <details> <summary>Release notes</summary> _Sourced from [OpenTelemetry.Extensions.Hosting's releases](https://github.com/open-telemetry/opentelemetry-dotnet/releases)._ ## 1.20.1 For highlights and announcements pertaining to this release see: [Release Notes > 1.20.1](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/RELEASENOTES.md#1201). The following changes are from the previous release [1.20.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.20.0). * NuGet: [OpenTelemetry v1.20.1](https://www.nuget.org/packages/OpenTelemetry/1.20.1) * Fixed a possible race condition on ARM64 when multiple threads record the first measurement with no tags, or the first overflow measurement, that could cause the measurement to be recorded incorrectly. ([#7951](open-telemetry/opentelemetry-dotnet#7951)) * Fixed self-diagnostics preamble redaction of quoted or encoded PEM material and prefixed JWTs. ([#7955](open-telemetry/opentelemetry-dotnet#7955)) * Fixed default HTTP client log filtering when registering the OTLP log exporter through `OpenTelemetryLoggerOptions`. ([#7959](open-telemetry/opentelemetry-dotnet#7959)) * Fixed legacy self-diagnostics logging terminating the process when the log file is truncated or the log volume runs out of space. ([#7956](open-telemetry/opentelemetry-dotnet#7956)) * **Experimental (pre-release builds only):** Fixed `Logger.EmitLog` ignoring instrumentation suppression, which could cause recursive exports or deadlocks. ([#7961](open-telemetry/opentelemetry-dotnet#7961)) * Fixed delta double counters losing subsequent measurements after a non-finite or large value and idle metric points with a `NaN` value failing to be reclaimed. ([#7963](open-telemetry/opentelemetry-dotnet#7963)) * Improve the assignment of values to exponential histogram buckets when the value is near a bucket boundary by using a pre-computed lookup table. ([#7911](open-telemetry/opentelemetry-dotnet#7911)) * Fixed `LogRecord`s being returned to the shared pool while still queued for export when an exporter stops enumerating a single-item or array `Batch<LogRecord>` early which could cause a `BatchLogRecordExportProcessor` on the same provider to export missing or incorrect data. ([#7965](open-telemetry/opentelemetry-dotnet#7965)) * Fixed a `SuppressInstrumentationScope.Enter()` reference count never being released when the `Activity` it was entered for is not recorded, which caused all subsequent telemetry in that execution context to be suppressed. ([#7966](open-telemetry/opentelemetry-dotnet#7966)) * Self-diagnostics log files, whether configured through `OTEL_DIAGNOSTICS.json` or `SelfDiagnosticsOptions`, are now always created as new files. ([#7968](open-telemetry/opentelemetry-dotnet#7968)) ... (truncated) ## 1.20.1-rc.1 The following changes are from the previous release [1.20.0](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/core-1.20.0). * NuGet: [OpenTelemetry v1.20.1-rc.1](https://www.nuget.org/packages/OpenTelemetry/1.20.1-rc.1) * Fixed a possible race condition on ARM64 when multiple threads record the first measurement with no tags, or the first overflow measurement, that could cause the measurement to be recorded incorrectly. ([#7951](open-telemetry/opentelemetry-dotnet#7951)) * Fixed self-diagnostics preamble redaction of quoted or encoded PEM material and prefixed JWTs. ([#7955](open-telemetry/opentelemetry-dotnet#7955)) * Fixed default HTTP client log filtering when registering the OTLP log exporter through `OpenTelemetryLoggerOptions`. ([#7959](open-telemetry/opentelemetry-dotnet#7959)) * Fixed legacy self-diagnostics logging terminating the process when the log file is truncated or the log volume runs out of space. ([#7956](open-telemetry/opentelemetry-dotnet#7956)) * **Experimental (pre-release builds only):** Fixed `Logger.EmitLog` ignoring instrumentation suppression, which could cause recursive exports or deadlocks. ([#7961](open-telemetry/opentelemetry-dotnet#7961)) * Fixed delta double counters losing subsequent measurements after a non-finite or large value and idle metric points with a `NaN` value failing to be reclaimed. ([#7963](open-telemetry/opentelemetry-dotnet#7963)) * Improve the assignment of values to exponential histogram buckets when the value is near a bucket boundary by using a pre-computed lookup table. ([#7911](open-telemetry/opentelemetry-dotnet#7911)) * Fixed `LogRecord`s being returned to the shared pool while still queued for export when an exporter stops enumerating a single-item or array `Batch<LogRecord>` early which could cause a `BatchLogRecordExportProcessor` on the same provider to export missing or incorrect data. ([#7965](open-telemetry/opentelemetry-dotnet#7965)) * Fixed a `SuppressInstrumentationScope.Enter()` reference count never being released when the `Activity` it was entered for is not recorded, which caused all subsequent telemetry in that execution context to be suppressed. ([#7966](open-telemetry/opentelemetry-dotnet#7966)) * Self-diagnostics log files, whether configured through `OTEL_DIAGNOSTICS.json` or `SelfDiagnosticsOptions`, are now always created as new files. ([#7968](open-telemetry/opentelemetry-dotnet#7968)) * Self-diagnostics messages written to the sinks configured by `SelfDiagnosticsOptions` are now truncated to 16,384 characters so that the ... (truncated) ## 1.20.1-beta.1 The following changes are from the previous release [1.20.0-beta.1](https://github.com/open-telemetry/opentelemetry-dotnet/releases/tag/coreunstable-1.20.0-beta.1). * NuGet: [OpenTelemetry.Exporter.Prometheus.AspNetCore v1.20.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.AspNetCore/1.20.1-beta.1) * Fixed scrape responses being handed to the server in a single write, which made the server buffer a full copy of the response for each client that did not read it until the request completed or timed out. Responses are now written in bounded slices so the server's back-pressure applies. ([#7957](open-telemetry/opentelemetry-dotnet#7957)) * Fixed startup scrapes permanently omitting `target_info` and configured resource constant labels from subsequent scrape responses. ([#7984](open-telemetry/opentelemetry-dotnet#7984)) * Updated OpenTelemetry core component version(s) to `1.20.1`. ([#7990](open-telemetry/opentelemetry-dotnet#7990)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.20.1-beta.1/src/OpenTelemetry.Exporter.Prometheus.AspNetCore/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Exporter.Prometheus.HttpListener v1.20.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Exporter.Prometheus.HttpListener/1.20.1-beta.1) * Fixed scrape responses being handed to the server in a single write, which on Linux and macOS made the listener allocate and hold a full copy of the response for each client that did not read it until the request completed or timed out. Responses are now written in bounded slices. ([#7957](open-telemetry/opentelemetry-dotnet#7957)) * Fixed scrape requests that announce a request body holding a thread pool thread after their response had been sent on Linux and macOS for as long as the client kept trickling in the body. The connection is now closed after responding to a request with a body instead of being kept alive. ([#7962](open-telemetry/opentelemetry-dotnet#7962)) * Fixed startup scrapes permanently omitting `target_info` and configured resource constant labels from subsequent scrape responses. ([#7984](open-telemetry/opentelemetry-dotnet#7984)) * Updated OpenTelemetry core component version(s) to `1.20.1`. ([#7990](open-telemetry/opentelemetry-dotnet#7990)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.20.1-beta.1/src/OpenTelemetry.Exporter.Prometheus.HttpListener/CHANGELOG.md) for details. * NuGet: [OpenTelemetry.Shims.OpenTracing v1.20.1-beta.1](https://www.nuget.org/packages/OpenTelemetry.Shims.OpenTracing/1.20.1-beta.1) * Updated OpenTelemetry core component version(s) to `1.20.1`. ([#7990](open-telemetry/opentelemetry-dotnet#7990)) See [CHANGELOG](https://github.com/open-telemetry/opentelemetry-dotnet/blob/coreunstable-1.20.1-beta.1/src/OpenTelemetry.Shims.OpenTracing/CHANGELOG.md) for details. Commits viewable in [compare view](open-telemetry/opentelemetry-dotnet@core-1.20.0...core-1.20.1). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cyrusjamula <19627536+cyrusjamula@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Marks the initialization flags in
AggregatorStoreasvolatilefor correctness on ARM64.The flags use double-checked locking: the metric point is written under a lock, then the flag is set.
Without
volatile, ARM64 can make the flag visible before the metric point write finishes. A thread recording the first measurement with no tags, or the first overflow measurement, could then see the flag set and use a partially initialized metric point. x86/x64 is not affected.x86/x64 guarantees that writes become visible in program order, and that reads are not reordered with other reads. The ARM64 memory model does not guarantee this behavior. Without
volatilethe flag can be read by other threads before the metric point write is visible.This is a memory-model fix and I have not observed it in practice. The added test covers the concurrent first-write path, but it cannot detect this issue on x86/x64.
Merge requirement checklist
CHANGELOG.mdfile(s) updated for non-trivial changesFootnotes
Yes, I can answer maintainer questions about the content of this PR without using AI. ↩