getsentry / raven-go

Sentry client in Go
https://sentry.io
BSD 3-Clause "New" or "Revised" License
561 stars 147 forks source link

Use pointer type for right use of mutex #212

Closed morikuni closed 5 years ago

morikuni commented 5 years ago

Hi, I found a bug in a default 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.

mattrobenolt commented 5 years ago

Thanks for the fix! 🍕

pierrre commented 5 years ago

Thank you ! :+1: I just had a panic/crash in production today concurrent map writes. I think it will fix it.