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

Nil pointer error in yfast trie #184

Open
shabbyrobe opened this issue Nov 28, 2017 · 0 comments
Open

Nil pointer error in yfast trie #184

shabbyrobe opened this issue Nov 28, 2017 · 0 comments

Comments

@shabbyrobe
Copy link

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())
	}
}
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

No branches or pull requests

1 participant