allegro / allegro/bigcache

panic: runtime error: makeslice: len out of range

Aperta
#258 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Go
Stelle
8.2k
Fork
614
Merge medio
5g 12h
PR unite (30g)
1

Descrizione

**What is the issue you are having?**
Panic when evicting the cache.
```
panic: runtime error: makeslice: len out of range

goroutine 1922 [running]:
github.com/allegro/bigcache/v3.readEntry(...)
/root/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.0/encoding.go:51
github.com/allegro/bigcache/v3.(*BigCache).providedOnRemoveWithReason(0xc00131c410, 0xc10359817d, 0x74, 0x199323, 0x1)
/root/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.0/bigcache.go:229 +0x188
github.com/allegro/bigcache/v3.(*cacheShard).removeOldestEntry(0xc0190fec60, 0x1, 0x0, 0x1b8fa72)
/root/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.0/shard.go:324 +0x102
github.com/allegro/bigcache/v3.(*cacheShard).onEvict(0xc0190fec60, 0xc10359817d, 0x74, 0x199323, 0x5fbf5b58, 0xc15827ae40, 0x0)
/root/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.0/shard.go:271 +0x5a
github.com/allegro/bigcache/v3.(*cacheShard).cleanUp(0xc0190fec60, 0x5fbf5b58)
/root/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.0/shard.go:282 +0xb6
github.com/allegro/bigcache/v3.(*BigCache).cleanUp(0xc00131c410, 0x5fbf5b58)
/root/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.0/bigcache.go:215 +0x53
github.com/allegro/bigcache/v3.newBigCache.func1(0x400, 0x61c9f36800, 0x1255dda3800, 0x927c0, 0x1f4, 0x100, 0x2f57ce0, 0x43c4b28, 0x2000, 0x0, ...)
/root/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.0/bigcache.go:92 +0x9b
created by github.com/allegro/bigcache/v3.newBigCache
/root/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.0/bigcache.go:86 +0x485
```

**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): v3.0.0
- OS (e.g. from `/etc/os-release` or winver.exe): Ubuntu 16.04.6 LTS
- go version: 1.15

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.