Skip to content

Backport of agent: remove data race in agent config into release/1.16.x#20202

Merged
rboyer merged 1 commit into
release/1.16.xfrom
backport/rboyer/fix-agent-config-race/heartily-pleased-sloth
Jan 16, 2024
Merged

Backport of agent: remove data race in agent config into release/1.16.x#20202
rboyer merged 1 commit into
release/1.16.xfrom
backport/rboyer/fix-agent-config-race/heartily-pleased-sloth

Conversation

@hc-github-team-consul-core
Copy link
Copy Markdown
Collaborator

Backport

This PR is auto-generated from #20200 to be assessed for backporting due to the inclusion of the label backport/1.16.

🚨

Warning automatic cherry-pick of commits failed. If the first commit failed,
you will see a blank no-op commit below. If at least one commit succeeded, you
will see the cherry-picked commits up to, not including, the commit where
the merge conflict occurred.

The person who merged in the original PR is:
@rboyer
This person should manually cherry-pick the original PR into a new backport PR,
and close this one when the manual backport PR is merged in.

merge conflict error: POST https://api.github.com/repos/hashicorp/consul/merges: 409 Merge conflict []

The below text is copied from the body of the original PR.


Description

To fix an issue displaying the current reloaded config in the v1/agent/self endpoint #18681 caused the agent's internal config struct member to be deepcopied and replaced on reload.

This is not safe because the field is not protected by a lock, nor should it be due to how it is accessed by the rest of the system.

This PR does the same deepcopy, but into a new field solely for the point of capturing the current reloaded values for display purposes. If there has been no reload then the original config is used.


Overview of commits

@hashicorp-cla
Copy link
Copy Markdown

hashicorp-cla commented Jan 12, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Auto approved Consul Bot automated PR

@rboyer rboyer marked this pull request as ready for review January 12, 2024 21:13
@rboyer rboyer enabled auto-merge (squash) January 12, 2024 21:14
To fix an issue displaying the current reloaded config in the
v1/agent/self endpoint #18681 caused the agent's internal
config struct member to be deepcopied and replaced on reload.

This is not safe because the field is not protected by a lock, nor
should it be due to how it is accessed by the rest of the system.

This PR does the same deepcopy, but into a new field solely for
the point of capturing the current reloaded values for display
purposes. If there has been no reload then the original config is used.
@rboyer rboyer force-pushed the backport/rboyer/fix-agent-config-race/heartily-pleased-sloth branch from 8067e8e to bef0272 Compare January 12, 2024 22:39
@rboyer rboyer disabled auto-merge January 16, 2024 17:11
@rboyer rboyer merged commit 6e3a3b4 into release/1.16.x Jan 16, 2024
@rboyer rboyer deleted the backport/rboyer/fix-agent-config-race/heartily-pleased-sloth branch January 16, 2024 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants