attic-labs / noms

The versioned, forkable, syncable database
Apache License 2.0
7.45k stars 267 forks source link

TestGraphBuilderNestedMapSet failing in a super sketchy way #3840

Closed aboodman closed 5 years ago

aboodman commented 5 years ago
!? go test -run TestGraphBuilderNestedMapSet
--- FAIL: TestGraphBuilderNestedMapSet (0.03s)
panic: runtime error: slice bounds out of range [recovered]
    panic: runtime error: slice bounds out of range

goroutine 5 [running]:
testing.tRunner.func1(0xc000112300)
    /usr/local/go/src/testing/testing.go:792 +0x387
panic(0x152b200, 0x1a2fd80)
    /usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/attic-labs/noms/go/types.(*graphStack).pop(...)
    /Users/aa/src/github.com/attic-labs/noms/go/types/graph_builder.go:248
github.com/attic-labs/noms/go/types.(*GraphBuilder).Build(0xc0000c8140, 0x0, 0x0)
    /Users/aa/src/github.com/attic-labs/noms/go/types/graph_builder.go:190 +0x41e
github.com/attic-labs/noms/go/types.TestGraphBuilderNestedMapSet(0xc000112300)
    /Users/aa/src/github.com/attic-labs/noms/go/types/graph_builder_test.go:301 +0x2e6
testing.tRunner(0xc000112300, 0x15cdf78)
    /usr/local/go/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
    /usr/local/go/src/testing/testing.go:878 +0x35c
exit status 2
FAIL    github.com/attic-labs/noms/go/types 0.048s

However. If I do this:

func (s *graphStack) pop() *graphStackElem {
    l := len(s.elems) - 1
+   fmt.Println(l)
    elem := s.elems[l]    // last element
    s.elems = s.elems[:l] // truncate last element
    return elem
}

... it works. Eep.

aboodman commented 5 years ago

This appears to have been an issue with Go 1.11. Fixed in 1.12.