open-consul/agent/consul/xdscapacity
Dan Upton 36a3d00f0d
bug: fix goroutine leaks caused by incorrect usage of WatchCh (#14916)
memdb's `WatchCh` method creates a goroutine that will publish to the
returned channel when the watchset is triggered or the given context
is canceled. Although this is called out in its godoc comment, it's
not obvious that this method creates a goroutine who's lifecycle you
need to manage.

In the xDS capacity controller, we were calling `WatchCh` on each
iteration of the control loop, meaning the number of goroutines would
grow on each autopilot event until there was catalog churn.

In the catalog config source, we were calling `WatchCh` with the
background context, meaning that the goroutine would keep running after
the sync loop had terminated.
2022-10-13 12:04:27 +01:00
..
capacity.go bug: fix goroutine leaks caused by incorrect usage of WatchCh (#14916) 2022-10-13 12:04:27 +01:00
capacity_test.go xDS Load Balancing (#14397) 2022-09-09 15:02:01 +01:00