Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A panic occurred, causing the lock to remain engaged.panic: makeslice: len out of range #401

Open
zzdeys opened this issue Jul 22, 2024 · 0 comments
Labels

Comments

@zzdeys
Copy link

zzdeys commented Jul 22, 2024

What is the issue you are having?
A panic occurred, causing the lock to remain engaged. Even if I use recover from the panic, the program cannot continue running because the lock is not released. When other goroutines try to use bigcache, they cannot acquire the lock and will wait indefinitely.

traces:
/data/bkdevops/apps/golang/1.18/src/runtime/panic-go: 838 +0x207
github.com/allegro/bigcache/v2.readEntry(...)
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.5/encoding-go:51
github. com/allegro/bigcache/v2. (*BigCache). providedOnRemoveWithReason(0xc55c947450, (0xc6b528cbbc, 0x34, 0X1145444}, 0x1)
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.5/bigcache.go:229 +0x1ae
github.com/allegro/bigcache/v2. (*cacheShard). remove0ldestEntry(0xc5ae07e360, 0x2c73c338?)
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.5/shard-go:324 +0xc9
github.com/allegro/bigcache/v2. (*cacheShard).onEvict(0x1186180?, {0xcbb528cbbc?,
0x27a5bcd3a24d8539?, 0x0?}, x0?, 0xc53c1f73e0?)
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.5/shard.go:271 +0x3f
github.com/allegro/bigcache/v2. (*cacheShard).set(0xc5ae07e360, {0xcb043126c0, 0x5a}, 0x27a5bcd3a24d8539, {0xc48f9e53c8, 0x20, 0xc48f9
e53c8?})
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.5/shard.go:132 +0x178
github.com/allegro/bigcache/v2. (*BigCache).Set(0xc55c947450, {0xcb043126c0, 0x5a}, {0xc48f9e53c8, 0x20, 0x20})
/root/go/pkg/mod/github.com/allegro/bigcache/v2@v2.2.5/bigcache.go:133 +0x8d

bigcache config:

Shards:             512,             
LifeWindow:         60 * time.Minute,
CleanWindow:        time.Second * 60, 
MaxEntriesInWindow: 1000 * 10 * 60,
MaxEntrySize:       4096,
Verbose:            false,
HardMaxCacheSize:   64 * 1024,

other info:
i put key to bigcache 50000/min
60000 keys in bigcache

What is BigCache doing that it shouldn't?

Minimal, Complete, and Verifiable Example

i cant provide minimal,because I cannt reliably reproduce this problem. It occurs randomly within 2 to 48 hours after the program starts.

Environment:

  • Version (git sha or release): v2.2.5
  • OS (e.g. from /etc/os-release or winver.exe): linux
  • go version: 1.18
@zzdeys zzdeys added the bug label Jul 22, 2024
zzdeys pushed a commit to zzdeys/bigcache that referenced this issue Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant