allegro / allegro/bigcache

panic: runtime error: makeslice: len out of range

オープン
#258 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Go
スター
8.2k
フォーク
614
平均マージ
5日 12時間
マージ済み PR(30日)
1

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。