allegro / allegro/bigcache

shard onEvict get an empty oldestEntry.so panic and not unLock

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

Descrizione

**What is the issue you are having?**

shard `onEvict` get an empty oldestEntry.so panic and not unLock

**What is BigCache doing that it shouldn't?**
fix panic

**Minimal, Complete, and Verifiable Example**
```
runtime error: index out of range [7] with length 0
goroutine 60116345 [running]:
runtime/debug.Stack(0x2153be0, 0x22c8700, 0xc1ec77bf40)
/usr/local/go/src/runtime/debug/stack.go:24 +0x9f
git.in.zhihu.com/go/utils.SafelyRun.func1(0xc1ea5fdf40)
/go/pkg/mod/git.in.zhihu.com/go/utils@v0.2.15/concurrent.go:20 +0x78
panic(0x22c8700, 0xc1ec77bf40)
/usr/local/go/src/runtime/panic.go:969 +0x175
encoding/binary.littleEndian.Uint64(...)
/usr/local/go/src/encoding/binary/binary.go:77
github.com/allegro/bigcache/v3.readTimestampFromEntry(...)
/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.1/encoding.go:58
github.com/allegro/bigcache/v3.(*cacheShard).onEvict(0xc0ba3fd7a0, 0xc166605820, 0x0, 0xbc7e0, 0x623d7f7d, 0xc1ea5fd730, 0x0)
/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.1/shard.go:271 +0x85
github.com/allegro/bigcache/v3.(*cacheShard).set(0xc0ba3fd7a0, 0xc1ecdc1ce0, 0x23, 0xd8bc05fe228582f8, 0xc1ecdd9200, 0x29d, 0x2c6, 0x0, 0x0)
/go/pkg/mod/github.com/allegro/bigcache/v3@v3.0.1/shard.go:134 +0x31a
github.com/allegro/bigcache/v3.(*BigCache).Set(0xc000214680, 0xc1ecdc1ce0, 0x23, 0xc1ecdd9200, 0x29d, 0x2c6, 0x0, 0x2105a00)
```
When asking a question about a problem caused by your code, you will get much better answers if you provide code we can use to reproduce the problem. That code should be...

* ...Minimal – Use as little code as possible that still produces the same problem
* ...Complete – Provide all parts needed to reproduce the problem
* ...Verifiable – Test the code you're about to provide to make sure it reproduces the problem

For more information on how to provide an MCVE, please see the [Stack Overflow documentation](https://stackoverflow.com/help/mcve).

**Environment:**
- Version (git sha or release): v3.0.1
- OS (e.g. from `/etc/os-release` or winver.exe): linux
- go version: go 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.