bigcache
bigcache copied to clipboard
panic: runtime error: index out of range [7] with length 0
panic: runtime error: index out of range [7] with length 0
goroutine 1417 [running]:
encoding/binary.littleEndian.Uint64(...)
/usr/local/go/src/encoding/binary/binary.go:77
github.com/allegro/bigcache/v3.readTimestampFromEntry(...)
.../pkg/mod/github.com/allegro/bigcache/[email protected]/encoding.go:58
github.com/allegro/bigcache/v3.(*cacheShard).onEvict(0xc0087c27e0, 0xc045dda415, 0x0, 0xafeb, 0x614ad1a7, 0xc0008a3e58, 0x0)
.../pkg/mod/github.com/allegro/bigcache/[email protected]/shard.go:271 +0x85
github.com/allegro/bigcache/v3.(*cacheShard).cleanUp(0xc0087c27e0, 0x614ad1a7)
.../pkg/mod/github.com/allegro/bigcache/[email protected]/shard.go:284 +0xb6
github.com/allegro/bigcache/v3.(*BigCache).cleanUp(0xc001b1e410, 0x614ad1a7)
.../pkg/mod/github.com/allegro/bigcache/[email protected]/bigcache.go:215 +0x53
github.com/allegro/bigcache/v3.newBigCache.func1(0x400, 0x34630b8a000, 0xdf8475800, 0x2800, 0x12, 0x101, 0x1142680, 0x196d898, 0x600, 0x0, ...)
.../pkg/mod/github.com/allegro/bigcache/[email protected]/bigcache.go:92 +0x9b
created by github.com/allegro/bigcache/v3.newBigCache
.../pkg/mod/github.com/allegro/bigcache/[email protected]/bigcache.go:86 +0x4a5
i found this panic caused by these codes :
bytes_queue.go#allocateAdditionalMemory
if leftMarginIndex != q.rightMargin {
copy(q.array, oldArray[:q.rightMargin])
if q.tail <= q.head {
if q.tail != q.head {
headerEntrySize := getUvarintSize(uint32(q.head - q.tail))
emptyBlobLen := q.head - q.tail - headerEntrySize
q.push(make([]byte, emptyBlobLen), emptyBlobLen)
}
q.head = leftMarginIndex
q.tail = q.rightMargin
}
}
here are one issue:
- q.push(make([]byte, emptyBlobLen), emptyBlobLen) value is not wrappedEntry bytes ,this cause , cleanUp method and pop head to recycle these spaces , and decodes ,these causes decoding panic. emptyBlobLen must be larger than minimumHeaderSize
https://github.com/allegro/bigcache/issues/283 ?
#283 ?
it's another panic .i want chat with ur telegram .
so, It fixed?
I believe it's fixed with v3.0.2