allegro / allegro/bigcache

panic: runtime error: slice bounds out of range [16:0]

Offen
#257 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Go
Sterne
8.2k
Forks
614
Ø Merge
5 T. 12 Std.
Gemergte PRs (30 T.)
1

Beschreibung

**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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.