-
Notifications
You must be signed in to change notification settings - Fork 11
Description
In updateServerList there is this comment:
gomemcache/memcache/config_poller.go
Line 114 in c1c93e4
| // updateServerList is not thread safe and should not be called without holding lock on clusterConfigMU |
However, when the method is called here:
gomemcache/memcache/config_poller.go
Line 109 in c1c93e4
| c.updateServerList(clusterConfig) |
I don't see that it is called with any mutex held. I only see clusterConfigMU ever held with a read-lock.
However, I believe there isn't actually a thread safety concern here. The prevClusterConfig appears to only be read/updated from readConfigAndUpdateServerList which is never called concurrently in the current code. The SetServers call on the ServerList is protected by a mutex so that is already protected. From what I can tell, the clusterConfigMU lock and thread safety comments could likely be removed to avoid confusion.