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: nil (*GerritCL).Commit when it shouldn’t be #21984
Comments
Change https://golang.org/cl/65475 mentions this issue: |
Underlying cause is tracked in golang/go#21984 Change-Id: Ie413f5ae0a3e3b859a3a4ae8463148d0065a46ec Reviewed-on: https://go-review.googlesource.com/65475 Reviewed-by: Heschi Kreinick <heschi@google.com> Run-TryBot: Heschi Kreinick <heschi@google.com>
This caused the goissues.org server to crash once too. I've since added a It happened at 5:28:56 am EDT, after the server has been running for many hours. It constantly iterates over every CL of most Gerrit projects. Given I haven't seen another nil Commit for days since then, I suspect this happens pretty rarely and is timing-sensitive (i.e., checking the same CL after time passes, it might no longer have a nil Commit). For example, CL 65473 (from issue report) has a non-nil Commit right now. |
Is it a race issue? Could we run maintner with the race detector enabled? |
I don't have enough information to say conclusively. It may be either a data race or a non-race (but still timing-related) logic issue. I tried running my maintner client with race detector a bit, and it didn't find any races. |
I just added a test in godata, but I can't reproduce this. My test was: func TestGerritMetaNonNil(t *testing.T) {
c := getGoData(t)
c.Gerrit().ForeachProjectUnsorted(func(gp *maintner.GerritProject) error {
var maxCL int32
gp.ForeachCLUnsorted(func(cl *maintner.GerritCL) error {
if cl.Meta == nil {
t.Errorf("%s: enumerated CL %d has nil Meta", gp.ServerSlashProject(), cl.Number)
}
if len(cl.Metas) == 0 {
t.Errorf("%s: enumerated CL %d has empty Metas", gp.ServerSlashProject(), cl.Number)
}
if cl.Commit == nil {
t.Errorf("%s: enumerated CL %d has nil Commit", gp.ServerSlashProject(), cl.Number)
}
if cl.Number > maxCL {
maxCL = cl.Number
}
return nil
})
// And test that CL won't yield an incomplete one either:
for n := int32(0); n <= maxCL; n++ {
cl := gp.CL(n)
if cl == nil {
continue
}
if cl.Meta == nil {
t.Errorf("%s: CL(%d) has nil Meta", gp.ServerSlashProject(), cl.Number)
}
if len(cl.Metas) == 0 {
t.Errorf("%s: CL(%d) has empty Metas", gp.ServerSlashProject(), cl.Number)
}
if cl.Commit == nil {
t.Errorf("%s: CL(%d) has nil Commit", gp.ServerSlashProject(), cl.Number)
}
}
return nil
})
} It does find the two deleted CLs from #22060, but no CLs with nil Commits. So, I'm not sure what to do for this issue. |
Change https://golang.org/cl/107296 mentions this issue: |
When I played with This seems to be very rare and hard to reproduce, but the issue is real and I don't have any evidence that it can't happen in the future again. An idea for how to proceed is the following. Before making Having What do you think of this as a way to move forward (to improve the API quality of the package and eventually its implementation too)? |
@shurcooL, that's what I did 4 minutes before your reply. :) See the CL above. |
I was just typing that I noticed you did pretty much exactly that (sans debug logging) in Patch Set 3 of that CL. :) From a quick glance, it looks fantastic. 👍 |
An example GerritCL value with an empty
Commit
field:This caused panics in at least one implementation since
Commit
was not checked./cc @kevinburke @bradfitz
The text was updated successfully, but these errors were encountered: