On 8/17/26 9:43 AM, Ales Musil wrote:
> Make sure the index is freed every time we are done with it.
>
> Fixes: 4bba54f5d5f8 ("controller: Skip LB route install when Service_Monitor
> is offline.")
> Signed-off-by: Ales Musil <[email protected]>
> ---
Hi Ales,
Thanks for the quick fix, applied to main!
> controller/route.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/controller/route.c b/controller/route.c
> index c6accfba3..cb424bec8 100644
> --- a/controller/route.c
> +++ b/controller/route.c
> @@ -194,9 +194,6 @@ evaluate_lb_route_gates(struct hmap *gates,
> struct ovsdb_idl_index *service_monitor_by_selector,
> struct uuidset *relevant_service_monitors)
> {
> - struct sbrec_service_monitor *filter =
> - sbrec_service_monitor_index_init_row(service_monitor_by_selector);
> -
> struct lb_route_gate *g;
> HMAP_FOR_EACH (g, node, gates) {
> const char *checks = smap_get(&g->route->external_ids,
> @@ -235,6 +232,9 @@ evaluate_lb_route_gates(struct hmap *gates,
> }
>
> const char *tracked_lp = g->route->tracked_port->logical_port;
> + struct sbrec_service_monitor *filter =
> + sbrec_service_monitor_index_init_row(
> + service_monitor_by_selector);
> sbrec_service_monitor_index_set_logical_port(filter, tracked_lp);
The leak happened when resetting index fields. This really makes me
wonder if we shouldn't harden the IDL index implementation to allow
users to actually reset fields instead of having to use a completely new
filter.
It's not really obvious from the API I guess. CC-ing Ilya for his
thoughts too on this matter.
> sbrec_service_monitor_index_set_type(filter, "load-balancer");
> sbrec_service_monitor_index_set_protocol(filter, protocol);
> @@ -256,14 +256,14 @@ evaluate_lb_route_gates(struct hmap *gates,
> !strcmp(monitor->status, "online");
> }
>
> + sbrec_service_monitor_index_destroy_row(filter);
> +
> if (g->any_online) {
> break;
> }
> }
> free(buf);
> }
> -
> - sbrec_service_monitor_index_destroy_row(filter);
> }
>
> /* Look up the gate decision for a specific route. Returns:
Regards,
Dumitru
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev