Closed altergui closed 1 year ago
full log attached fatal error: concurrent map read and map write.log.gz
it does look like a concurrency issue inside simplelru, wtf this is writing
gateway0_1 | goroutine 1400 [runnable]:
gateway0_1 | github.com/hashicorp/golang-lru/v2/simplelru.(*LRU[...]).Add(0x3e447e0, {0xc0007c3bd0, 0x41}, {0xc005fd5e00, 0xfa, 0x200})
gateway0_1 | /home/user/go/pkg/mod/github.com/hashicorp/golang-lru/v2@v2.0.2/simplelru/lru.go:58
c.items[key] = ent
and this one is reading
gateway0_1 | goroutine 745741 [running]:
gateway0_1 | github.com/hashicorp/golang-lru/v2/simplelru.(*LRU[...]).Get(0x3e447e0, {0x0, 0x7?})
gateway0_1 | /home/user/go/pkg/mod/github.com/hashicorp/golang-lru/v2@v2.0.2/simplelru/lru.go:70 +0x3d
gateway0_1 | go.vocdoni.io/dvote/data/ipfs.(*Handler).Retrieve(0xc000a4e3c0, {0x3e0fd58, 0xc0085cb110}, {0x0?, 0x50?}, 0x100000)
gateway0_1 | /home/user/src/vocdoni/vocdoni-node/data/ipfs/ipfs.go:265 +0xdb
if ent, ok := c.items[key]; ok {
oh. wait.
// LRU implements a non-thread safe fixed size LRU cache
:facepalm:
https://pkg.go.dev/github.com/hashicorp/golang-lru/v2
All caches in this package take locks while operating, and are therefore thread-safe for consumers.
but that refers to caches (ARCCache, Cache or TwoQueueCache) not to the LRU
git says i should ping @mvdan or @p4u :heart_eyes:
Disclaimer: i came across this while testing #925, so not on
master
. so there's a chance that it's a bug of that particular PR, but i want to copypaste the full stack trace here, just in case it's an actual bug frommaster
that only happens very rarelyit's just a snip, there were thousands of goroutines in
select
orchan receive
, orio wait
. i just pasted here the only onerunning
and the 6 onesrunnable