Skip to content

fix DATA RACE in TestCertRoute#1168

Merged
kmesh-bot merged 1 commit intokmesh-net:mainfrom
lec-bit:main
Jan 13, 2025
Merged

fix DATA RACE in TestCertRoute#1168
kmesh-bot merged 1 commit intokmesh-net:mainfrom
lec-bit:main

Conversation

@lec-bit
Copy link
Copy Markdown
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
@codecov
Copy link
Copy Markdown

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.

time.Sleep(2 * time.Second)
for {
cert2 := secretManager.GetCert(identity1)
secretManager.certsCache.mu.RLock()
Copy link
Copy Markdown
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
Copy Markdown
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
Signed-off-by: lec-bit <glfhmzmy@126.com>
secretManager.certsCache.mu.RUnlock()
break
}
secretManager.certsCache.mu.RUnlock()
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Details 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
Copy link
Copy Markdown
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