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 flaky CT submission bug #1085

Merged
merged 19 commits into from
Jun 23, 2023
Merged

Fix flaky CT submission bug #1085

merged 19 commits into from
Jun 23, 2023

Conversation

breadyzhang
Copy link
Contributor

@breadyzhang breadyzhang commented May 17, 2023

Fixes #1084

Use a single integer (remainingSubmissions) instead of a map (groupNeeds) for checking how many submissions are needed. The map is no longer needed since the new CT policies don't require submissions from specific log operators. Using an integer simplifies the logic for determining how many more submissions are needed and whether or not the safeSubmissionsState should store the returned SCT.

The chromelike unit test under submission/races_test.go:TestGetSCTs now properly tests for the flake.

Checklist

@breadyzhang breadyzhang requested a review from a team as a code owner May 17, 2023 22:25
@breadyzhang breadyzhang requested review from getagit and removed request for a team May 17, 2023 22:25
@roger2hk roger2hk requested review from roger2hk and removed request for getagit May 18, 2023 07:40
submission/races.go Outdated Show resolved Hide resolved
ctpolicy/chromepolicy.go Outdated Show resolved Hide resolved
ctpolicy/chromepolicy_test.go Outdated Show resolved Hide resolved
submission/races.go Outdated Show resolved Hide resolved
Freddy Zhang and others added 12 commits June 2, 2023 12:46
…ine how safeSubmissionState decides which SCTs to insert in the results
- move base into switch expression

- change maxSubmissionsPerGroup to maxSubmissionsPerOperator
Fix building when the new `wasip1` port is being used.
This is a new target that will be introduced by go 1.21.

For more details golang/go#58141

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
@breadyzhang
Copy link
Contributor Author

I accidentally closed the PR due to a merge conflict mishap I had.

breadyzhang added 2 commits June 6, 2023 10:33
…string]int so I am reverting it back to the updated state
…to groupsSubmitted

groupNeeds was used for the old chrome policy when we required SCTs from specific groups. It's not necessary anymore with the new policies so a single integer (minSubmissions) should be suffice.

groups is changed to groupsSubmitted to make it easier to understand upon a glance.
submission/races.go Outdated Show resolved Hide resolved
@roger2hk roger2hk requested a review from mhutchinson June 13, 2023 17:29
Copy link
Contributor

@mhutchinson mhutchinson left a comment

Choose a reason for hiding this comment

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

Can you link to #1084 from the PR description so that GitHub can cross-link these?

I'm not familiar at all with this code so will need to bounce this to someone else for review. One thing that seems missing from this PR is a test case that demonstrates the bug you are fixing. I see some changes in the tests but I can't see the relevance to my understanding of the issue.

ctpolicy/chromepolicy.go Outdated Show resolved Hide resolved
@mhutchinson mhutchinson requested a review from AlCutter June 14, 2023 09:00
@breadyzhang
Copy link
Contributor Author

Can you link to #1084 from the PR description so that GitHub can cross-link these?

I have updated the PR description to link #1084 and added a general comment on the main changes in the PR.

One thing that seems missing from this PR is a test case that demonstrates the bug you are fixing. I see some changes in the tests but I can't see the relevance to my understanding of the issue.

Currently in submission/races_test.go, the chromelike test in TestGetSCTs doesn't properly set up a "chromelike" scenario. The unit test would pass because the MinInclusions for non-BaseName groups were set (but they shouldn't be). Configuring the LogPolicyData to not set the MinInclusions in the non-BaseName groups shows the flake happening in the unit test.

@phbnf phbnf self-requested a review June 15, 2023 08:55
submission/races.go Outdated Show resolved Hide resolved
submission/races.go Outdated Show resolved Hide resolved
// Set the result only if the base group still needs SCTs more than total counts
// of minimum inclusions for other groups.
if sub.groupNeeds[ctpolicy.BaseName] > minInclusionsForOtherGroup {
if sub.remainingSubmissions > extraSubmissions {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this just be: extraSubmissions > 0?
Why does it compare a number of SCTs, with a number of groups?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

extraSubmissions represents the number of SCTs that need to be submitted to other log operators. If we are in this part of the branch, it implies that an SCT has already been submitted under this log operator. We need to make sure that adding this SCT to sub.results will still allow us to satisfy the distinct log operator criterion. For example, a certificate that has a lifetime > 180 days requires 3 SCTs but only 2 distinct log operators. This means we can use 2 SCTs from 1 log operator. We need to compare extraSubmissions with sub.remainingSubmissions

extraSubmissions was a misleading name. I have renamed it to reservedSubmissions and added a comment to clear up the confusion.

}
}
sub.remainingSubmissions--
} else if sub.remainingSubmissions > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

This branch is only executed if sub.results[logURL].sct == nil, i.e if the SCT was not matched to a groupName above. Is this even something that we want to allow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sub.results[logURL].sct == nil means a previous SCT has been set in sub.results from the same log operator (the sct gets set to nil in sub.request(...)). This branch is used for the situation where an SCT from an already submitted log operator can be used in the results.

submission/races.go Outdated Show resolved Hide resolved
@phbnf
Copy link
Contributor

phbnf commented Jun 21, 2023

/gcbrun

@phbnf phbnf merged commit 1bf39e3 into google:master Jun 23, 2023
breadyzhang added a commit to breadyzhang/certificate-transparency-go that referenced this pull request Sep 20, 2023
roger2hk pushed a commit that referenced this pull request Sep 20, 2023
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.

CT flaky submission failures
6 participants