allegro / allegro/bigcache

panic: runtime error: makeslice: len out of range

Abierto
#258 1 comentario 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
Go
Estrellas
8.2k
Forks
614
Merge medio
5 d 12 h
PR fusionados (30 d)
1

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.