-
Notifications
You must be signed in to change notification settings - Fork 79
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Continue to review full report in Codecov by Sentry.
|
@@ -123,12 +123,13 @@ func runTestCertRotate(t *testing.T) { | |||
time.Sleep(2 * time.Second) | |||
for { | |||
cert2 := secretManager.GetCert(identity1) | |||
secretManager.certsCache.mu.RLock() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any good suggestion?
d64aacc
to
8557b43
Compare
Signed-off-by: lec-bit <[email protected]>
newCert = *cert2.cert | ||
secretManager.certsCache.mu.RUnlock() | ||
break | ||
} | ||
secretManager.certsCache.mu.RUnlock() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L129 RUnlock
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[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 |
In response to a cherrypick label: new pull request created: #1178 |
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?: