Skip to content

[chore][receiver/k8scluster] Prevent concurrent metadata access by reordering initialization#44136

Merged
ChrsMark merged 12 commits into
open-telemetry:mainfrom
paulojmdias:fix/concurrency_guardrails
Dec 17, 2025
Merged

[chore][receiver/k8scluster] Prevent concurrent metadata access by reordering initialization#44136
ChrsMark merged 12 commits into
open-telemetry:mainfrom
paulojmdias:fix/concurrency_guardrails

Conversation

@paulojmdias
Copy link
Copy Markdown
Member

Description

Add RWMutex protection for metadataConsumers and entityLogConsumer fields in resourceWatcher to prevent potential data races during concurrent access.

Link to tracking issue

Relates to #43084 (comment)

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
@paulojmdias paulojmdias marked this pull request as ready for review November 10, 2025 22:59
@github-actions github-actions Bot requested a review from povilasv November 10, 2025 23:00
@dmitryax
Copy link
Copy Markdown
Member

Instead of adding a mutex, I think we can just remove the chance of concurrent calls by running setupMetadataExporters before setting up the watchers. It should be an easy change in startReceiver function.

@paulojmdias
Copy link
Copy Markdown
Member Author

Thanks for the heads-up @dmitryax. I proceed accordingly, PTAL when you have a chance.

@github-actions
Copy link
Copy Markdown
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

Copy link
Copy Markdown
Member

@ChrsMark ChrsMark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM based on #44136 (comment).

Please tune the PR tittle to reflect the current implemention :)

@paulojmdias paulojmdias changed the title [chore][receiver/k8scluster] Add mutex protection for metadata consumers [chore][receiver/k8scluster] Prevent concurrent metadata access by reordering initialization Dec 17, 2025
@paulojmdias
Copy link
Copy Markdown
Member Author

LGTM based on #44136 (comment).

Please tune the PR tittle to reflect the current implemention :)

Done. Thank you @ChrsMark 🙏

@ChrsMark ChrsMark merged commit c403efa into open-telemetry:main Dec 17, 2025
189 checks passed
@github-actions github-actions Bot added this to the next release milestone Dec 17, 2025
@paulojmdias paulojmdias deleted the fix/concurrency_guardrails branch December 17, 2025 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants