We've been seeing a nondeterministic fatal error: concurrent map writes error while using PGX. I traced it to the c.membersMap[s] = s line, and I think that this is a true issue - there doesn't appear to be anything preventing concurrent access to this map.
This PR adds a sync.RWMutex to EnumCodec and calls the appropriate RLock or Lock methods around read or write access.
We've been seeing a nondeterministic
fatal error: concurrent map writes
error while using PGX. I traced it to thec.membersMap[s] = s
line, and I think that this is a true issue - there doesn't appear to be anything preventing concurrent access to this map.This PR adds a
sync.RWMutex
toEnumCodec
and calls the appropriateRLock
orLock
methods around read or write access.