-
Notifications
You must be signed in to change notification settings - Fork 606
Open
Labels
Description
Bigcache runs for about 1 day, crash!
How to solve this problem?
My bigcache configuration is:
master_config := bigcache.DefaultConfig(300 * time.Second)
master_config.MaxEntriesInWindow = 10
master_config.HardMaxCacheSize = 2048
master_config.OnRemoveWithReason = func(key string, entry []byte, reason bigcache.RemoveReason) {
log.Info().Msgf("master bigcache OnRemove key[%s]entry[%s]reason[%d]Expired(1)NoSpace(2)Deleted(3)", key, entry, reason)
}
var initErr error
g_bigcache, initErr = bigcache.NewBigCache(master_config)
if initErr != nil {
log.Error().Err(initErr).Msgf("NewBigCache g_bigcache initErr!")
}
I used the Set, Get, Iterator(), SetNext() functions of bigcache.
The log of crash is as follows:
2020/05/29 17:38:31 Allocated new queue in 84.16µs; Capacity: 2560000 6
2020/05/29 17:38:31 Allocated new queue in 130.649µs; Capacity: 2560000 6
2020/05/29 17:38:32 Allocated new queue in 197.943µs; Capacity: 4194304 9
2020/05/29 17:38:33 Allocated new queue in 130.092µs; Capacity: 4194304 9
panic: runtime error: index out of range [7] with length 1
goroutine 188 [running]:
panic(0x127da40, 0xc01a3417a0)
/usr/local/go/src/runtime/panic.go:1064 +0x46d fp=0xc003264d88 sp=0xc003264cd0 pc=0x4461cd
runtime.goPanicIndex(0x7, 0x1)
/usr/local/go/src/runtime/panic.go:88 +0xa3 fp=0xc003264dd0 sp=0xc003264d88 pc=0x443f73
encoding/binary.littleEndian.Uint64(...)
/usr/local/go/src/encoding/binary/binary.go:77
github.com/allegro/bigcache/v2.readTimestampFromEntry(...)
/root/go/pkg/mod/github.com/widelee/bigcache/v2@v2.2.1/encoding.go:43
github.com/allegro/bigcache/v2.(*cacheShard).onEvict(0xc0016777a0, 0xc00e23a860, 0x1, 0x3f37a0, 0x5ed0d923, 0xc003264e40, 0x0)
/root/go/pkg/mod/github.com/widelee/bigcache/v2@v2.2.1/shard.go:247 +0x7d fp=0xc003264df8 sp=0xc003264dd0 pc=0xe754fd
github.com/allegro/bigcache/v2.(*cacheShard).cleanUp(0xc0016777a0, 0x5ed0d923)
/root/go/pkg/mod/github.com/widelee/bigcache/v2@v2.2.1/shard.go:260 +0xb9 fp=0xc003264e60 sp=0xc003264df8 pc=0xe755c9
github.com/allegro/bigcache/v2.(*BigCache).cleanUp(0xc001010820, 0x5ed0d923)
/root/go/pkg/mod/github.com/widelee/bigcache/v2@v2.2.1/bigcache.go:215 +0x53 fp=0xc003264e98 sp=0xc003264e60 pc=0xe71b73
github.com/allegro/bigcache/v2.newBigCache.func1(0x400, 0x45d964b800, 0x3b9aca00, 0xa, 0x1f4, 0x100, 0x1528580, 0x5e7db28, 0x1000, 0x0, ...)
/root/go/pkg/mod/github.com/widelee/bigcache/v2@v2.2.1/bigcache.go:92 +0x9b fp=0xc003264f60 sp=0xc003264e98 pc=0xe7663b
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1373 +0x1 fp=0xc003264f68 sp=0xc003264f60 pc=0x479481
created by github.com/allegro/bigcache/v2.newBigCache
/root/go/pkg/mod/github.com/widelee/bigcache/v2@v2.2.1/bigcache.go:86 +0x46f
Reactions are currently unavailable