turbobytes / geoipdb

GeoIP related related helper functions for TurboBytes stack
MIT License
0 stars 2 forks source link

concurrent map writes causes cnc to panic #24

Closed sajal closed 7 years ago

sajal commented 7 years ago

Panic caused at : https://github.com/turbobytes/geoipdb/blob/c20a6ca6a6f3b33301955d03a02bba07d2390edf/cache.go#L73

I see that map operation is wrapped in a lock, but maybe something else started writing to it at the same time without locking?

crashlog snippet: https://gist.github.com/sajal/a567bd6d5f168e12cda67dc737cc21d9

sajal commented 7 years ago

The problem is with sync.Mutex . It really needs to be a pointer

https://gist.github.com/sajal/50e173fcd3fa043f46e1e5084512d5de

go run buggy.go 2>&1 | less