Closed morikuni closed 5 years ago
Hi, I found a bug in a default SourceCodeLoader.
SourceCodeLoader
fsLoader uses sync.Mutex, but its receiver type of Load is a value. So mu.Lock and mu.Unlock does not affects shared state. It causes race condition when writing fsLoader.cache from multiple goroutines.
fsLoader
sync.Mutex
Load
mu.Lock
mu.Unlock
fsLoader.cache
Thanks for the fix! 🍕
Thank you ! :+1: I just had a panic/crash in production today concurrent map writes. I think it will fix it.
concurrent map writes
Hi, I found a bug in a default
SourceCodeLoader
.fsLoader
usessync.Mutex
, but its receiver type ofLoad
is a value. Somu.Lock
andmu.Unlock
does not affects shared state. It causes race condition when writingfsLoader.cache
from multiple goroutines.