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

Iterator: index out of range #107

Closed
tangtony opened this issue Nov 20, 2018 · 2 comments
Closed

Iterator: index out of range #107

tangtony opened this issue Nov 20, 2018 · 2 comments
Labels

Comments

@tangtony
Copy link

Has anyone else seen this issue when using the iterator? It only happens occasionally and I haven't found a way to reproduce this:

panic: runtime error: index out of range

goroutine 186467 [running]:
encoding/binary.littleEndian.Uint64(...)
        /usr/local/go/src/encoding/binary/binary.go:76
myapp/vendor/github.com/allegro/bigcache.readTimestampFromEntry(...)
        /go/src/myapp/vendor/github.com/allegro/bigcache/encoding.go:45
myapp/vendor/github.com/allegro/bigcache.(*EntryInfoIterator).Value(0xc024444050, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /go/src/myapp/vendor/github.com/allegro/bigcache/iterator.go:117 +0x555
myapp/cache.GetAllEntries.func1(0xc004b3d020)
        /go/src/myapp/cache/cache.go:41 +0x9f
created by myapp/cache.GetAllEntries
        /go/src/myapp/cache/cache.go:38 +0x58

My code looks like this:

func GetAllEntries() <-chan []byte {
	entries := make(chan []byte)
	go func() {
		iter := cache.Iterator()
		for iter.SetNext() {
			if entry, err := iter.Value(); err == nil {
				entries <- entry.Value()
			}
		}
		close(entries)
	}()
	return entries
}
@cristaloleg
Copy link
Collaborator

Hm.. that's interesting.

@siennathesane
Copy link
Collaborator

Closing as resolved in #108.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants