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

x/build/maintner: GerritMeta.LabelVotes may panic if one of the commits it loops over is not present in corpus #50474

Closed
dmitshur opened this issue Jan 6, 2022 · 2 comments
Labels
Builders x/build issues (builders, bots, dashboards) NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dmitshur
Copy link
Contributor

dmitshur commented Jan 6, 2022

Inside the GerritMeta.LabelVotes method, there's code like:

oldCommit := m.CL.Project.GitCommit(lastCommit)
newCommit := m.CL.Project.GitCommit(commit)
if !oldCommit.SameDiffStat(newCommit) {

Since it iterates over known patch sets of a given Gerrit CL, it's expected both oldCommit and newCommit will be non-nil, otherwise it'd panic. The current version of GerritMeta.LabelVotes is only used on the https://dev.golang.org/reviews page, and it's expected to always work, so it doesn't currently return an error.

Issue #47695 showed, at least one time, an instance where that wasn't the case. It hasn't happened again. My current best understanding is that it may have been some race, possibly in Gerrit itself, but it's not clear if it was a one-off problem that was resolved, or may continue to happen again.

This is a tracking issue to decide how to best handle this, especially if it becomes a problem again.

My current preference is to deprecate/remove GerritMeta.LabelVotes from x/build/maintner and move its implementation to x/build/devapp, the only place where it's used. The method seems to rely on too many heuristics and doesn't fit with the rest of maintner API; if we can't make it work well in the general case, we shouldn't try to offer it.

@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 6, 2022
@dmitshur dmitshur added this to the Unreleased milestone Jan 6, 2022
@gopherbot gopherbot added the Builders x/build issues (builders, bots, dashboards) label Jan 6, 2022
@gopherbot
Copy link

Change https://go.dev/cl/407394 mentions this issue: maintner: return an explicit error from (*GerritProject).GitCommit

@gopherbot
Copy link

Change https://go.dev/cl/408194 mentions this issue: devapp: propagate updateReviewsData error from ForeachProjectUnsorted

gopherbot pushed a commit to golang/build that referenced this issue May 24, 2022
CL 407394 added a detailed error in case of a rare, unexpected problem.
Propagate it in one more place so we benefit from the new information
if this happens again.

Updates golang/go#47695.
Updates golang/go#50474.

Change-Id: Iddb9a8d8de320d535fd15842c60bf0274391f8f2
Reviewed-on: https://go-review.googlesource.com/c/build/+/408194
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Builders x/build issues (builders, bots, dashboards) NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants