You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
removeUpstream is setting a done bool under lock but the startUpstream loop reads that bool while not holding the lock which is a data race.
there is no way to close/stop watcher and free goroutines. This is not a big deal in normal usage but our lesson from Consul's TestAgent is that this pattern leads to really inefficient test runs with tons of orphan goroutines by the end etc. I'd recommend plumbing a Stop mechanism or Context through every goroutine spawned right from the start so all resources can be cleaned up in tests and in case you ever need to support managing multiple proxies or decoupling process lifetime and proxy lifetime etc. It's way easier if it's just there already!
The text was updated successfully, but these errors were encountered:
https://github.com/haproxytech/haproxy-consul-connect/blob/master/consul/watcher.go
I see a couple of issues in the watcher:
removeUpstream
is setting a done bool under lock but the startUpstream loop reads that bool while not holding the lock which is a data race.TestAgent
is that this pattern leads to really inefficient test runs with tons of orphan goroutines by the end etc. I'd recommend plumbing a Stop mechanism or Context through every goroutine spawned right from the start so all resources can be cleaned up in tests and in case you ever need to support managing multiple proxies or decoupling process lifetime and proxy lifetime etc. It's way easier if it's just there already!The text was updated successfully, but these errors were encountered: