panic: runtime error: slice bounds out of range [16:0]
- Dominant language
- Go
- Stars
- 8.2k
- Forks
- 614
- Avg merge
- 5d 12h
- Merged PRs (30d)
- 1
Description
**What is the issue you are having?**
Panic when calling Get()
```
2020-11-26 14:27:29.336176 I | Allocated new queue in 841.579µs; Capacity: 2340000
panic: runtime error: slice bounds out of range [16:0]
goroutine 33821663 [running]:
github.com/allegro/bigcache/v2.readKeyFromEntry(...)
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.4/encoding.go:47
github.com/allegro/bigcache/v2.(*cacheShard).get(0xc0259f10e0, 0xc057fafac0, 0x20, 0x2f40a1f0106a7737, 0x0, 0x0, 0xc057fe9490, 0xc057fcdc40, 0xc05830adb0)
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.4/shard.go:69 +0x657
github.com/allegro/bigcache/v2.(*BigCache).Get(0xc00230aa90, 0xc057fafac0, 0x20, 0x2741b20, 0xc058332f70, 0x0, 0x0, 0x0)
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.4/bigcache.go:117 +0x8b
```
**What is BigCache doing that it shouldn't?**
Panic
**Minimal, Complete, and Verifiable Example**
My service do a high number of get operations.
This is my config:
```
expiry := 7 * time.Minute
conf := bigcache.DefaultConfig(expiry)
conf.CleanWindow = expiry * 3
conf.HardMaxCacheSize = 8192
conf.OnRemoveWithReason = func(_ string, entry []byte, reason bigcache.RemoveReason) {
// monitoring
}
```
**Environment:**
- Version (git sha or release): v2.2.4
- OS (e.g. from `/etc/os-release` or winver.exe): Ubuntu 16.04.6 LTS
- go version: 1.15
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.