Skip to content

Fix concurrent access to enabled features in metrics forwarder - #3413

Closed
tbavelier wants to merge 1 commit into
mainfrom
tbavelier/fix-mf-race
Closed

Fix concurrent access to enabled features in metrics forwarder#3413
tbavelier wants to merge 1 commit into
mainfrom
tbavelier/fix-mf-race

Conversation

@tbavelier

Copy link
Copy Markdown
Member

Summary

Apply the fix from #3412 to snapshot EnabledFeatures under a read lock before iterating and sending feature metrics. This prevents concurrent map iteration/write crashes without holding the lock during network calls.

Validation

  • make build
  • make ci-test
  • make update-golang
  • All commands completed successfully with no git diffs.

The metrics forwarding loop could iterate over EnabledFeatures while a
reconciliation updated the map, causing a fatal concurrent map iteration
and map write error.

Clone the map under a read lock and iterate over the snapshot, avoiding
concurrent access without holding the lock while sending metrics.

This fix doesn't fix the potential of map value slices concurrent
modifications, however, that scenario is currently not present in the
code as the values are set as whole slices and guarded by the
setEnabledFeatures(..) function.
@tbavelier tbavelier added this to the v1.31.0 milestone Sep 1, 2026
@tbavelier tbavelier added the bug Something isn't working label Sep 1, 2026
@tbavelier
tbavelier force-pushed the tbavelier/fix-mf-race branch from f2d08cc to 043ed82 Compare September 1, 2026 12:37
@datadog-prod-us1-6

This comment has been minimized.

@tbavelier

Copy link
Copy Markdown
Member Author

Closing, was only done to trigger CI on the contributor commit

@tbavelier tbavelier closed this Sep 1, 2026
@tbavelier
tbavelier deleted the tbavelier/fix-mf-race branch September 1, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working team/container-platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants