-
Notifications
You must be signed in to change notification settings - Fork 54
Description
The UpdateApp method on EurekaConnection starts a goroutine that periodically unmarshals a new Application value, and then assigns it wholesale to an Application that represented the previous version of that Eureka application.
Per my note in file net.go, such assignment is not safe without either synchronization or use of atomic store and load operations. It's possible for a goroutine reading the Application value submitted to UpdateApp to observe a corrupted value. Per The Go Memory Model,
Reads and writes of values larger than a single machine word behave as multiple machine-word-sized operations in an unspecified order.
Since we can't orchestrate all the reads of the Application value submitted to UpdateApp, I suggest instead that UpdateApp offer a single-valued buffered channel from which interested clients can receive updates.