Nil pointer error in yfast trie
shabbyrobe opened this issue · 0 comments
shabbyrobe commented
Here's a minimal reproducing example using Go 1.9 on macOS Sierra. I couldn't break it down any further. It will fail pretty much every time, but at a different loop iteration. I tried to simplify the example but this was the simplest that would reliably reproduce the problem.
type Entry uint64
func (s Entry) Key() uint64 { return uint64(s) }
func main() {
y := yfast.New(uint64(1))
i := 0
defer func() {
err := recover()
fmt.Println(i)
panic(err)
}()
for ; i < 10000; i++ {
e1 := Entry(time.Now().UnixNano())
y.Insert(e1)
e2 := Entry(time.Now().Add(20 * time.Millisecond).UnixNano())
y.Insert(e2)
e3 := Entry(time.Now().Add(10 * time.Millisecond).UnixNano())
y.Insert(e3)
y.Delete(e3.Key())
}
}