Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix DATA RACE in TestCertRoute #1168

Merged
merged 1 commit into from
Jan 13, 2025
Merged

fix DATA RACE in TestCertRoute #1168

merged 1 commit into from
Jan 13, 2025

Conversation

lec-bit
Copy link
Contributor

@lec-bit lec-bit commented Jan 9, 2025

What type of PR is this?
/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #1167

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@kmesh-bot kmesh-bot added the kind/bug Something isn't working label Jan 9, 2025
Copy link

codecov bot commented Jan 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@d8c0539). Learn more about missing BASE report.
Report is 12 commits behind head on main.


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8c0539...24836d7. Read the comment docs.

@@ -123,12 +123,13 @@ func runTestCertRotate(t *testing.T) {
time.Sleep(2 * time.Second)
for {
cert2 := secretManager.GetCert(identity1)
secretManager.certsCache.mu.RLock()
Copy link
Member

Choose a reason for hiding this comment

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

This code looks strange, cert2 is not protected between secretManager.GetCert(identity1) and this line.

Copy link
Member

Choose a reason for hiding this comment

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

Any good suggestion?

@lec-bit lec-bit force-pushed the main branch 2 times, most recently from d64aacc to 8557b43 Compare January 10, 2025 07:18
newCert = *cert2.cert
secretManager.certsCache.mu.RUnlock()
break
}
secretManager.certsCache.mu.RUnlock()
Copy link
Member

Choose a reason for hiding this comment

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

This is not right, you should also consider break in L130

Copy link
Contributor Author

Choose a reason for hiding this comment

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

L129 RUnlock

Copy link
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

/lgtm

@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot kmesh-bot merged commit e08a108 into kmesh-net:main Jan 13, 2025
12 checks passed
@kmesh-bot
Copy link
Collaborator

In response to a cherrypick label: new pull request created: #1178

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.

TestCertRotate cert access data race
4 participants