diff mbox series

[ovs-dev] northd: Fix leak of lflow scratchpads.

Message ID 20201118225800.1540201-1-i.maximets@ovn.org
State Accepted
Headers show
Series [ovs-dev] northd: Fix leak of lflow scratchpads. | expand

Commit Message

Ilya Maximets Nov. 18, 2020, 10:58 p.m. UTC
Dynamic strings that backs 'match' and 'actions' are never destroyed
and leaked on every lflow re-build cycle.

 28,224 bytes in 126 blocks are definitely lost in loss record 494 of 498
    at 0x483BD19: realloc (vg_replace_malloc.c:834)
    by 0x4AEF14: xrealloc (util.c:149)
    by 0x465533: ds_reserve (dynamic-string.c:63)
    by 0x46587B: ds_put_format_valist (dynamic-string.c:161)
    by 0x465956: ds_put_format (dynamic-string.c:142)
    by 0x42187F: build_ipv6_input_flows_for_lrouter_port (ovn-northd.c:11188)
    by 0x42187F: build_lswitch_and_lrouter_iterate_by_op (ovn-northd.c:11279)
    by 0x42187F: build_lswitch_and_lrouter_flows.constprop.0 (ovn-northd.c:11316)
    by 0x422503: build_lflows (ovn-northd.c:11398)
    by 0x42478D: ovnnb_db_run (ovn-northd.c:12334)
    by 0x42478D: ovn_db_run (ovn-northd.c:12927)
    by 0x408E84: main (ovn-northd.c:13333)

Fixes: ddf9f1d71319 ("ovn-northd: reorganize processing of lflows")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 northd/ovn-northd.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Numan Siddique Nov. 19, 2020, 7:04 a.m. UTC | #1
On Thu, Nov 19, 2020 at 4:28 AM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> Dynamic strings that backs 'match' and 'actions' are never destroyed
> and leaked on every lflow re-build cycle.
>
>  28,224 bytes in 126 blocks are definitely lost in loss record 494 of 498
>     at 0x483BD19: realloc (vg_replace_malloc.c:834)
>     by 0x4AEF14: xrealloc (util.c:149)
>     by 0x465533: ds_reserve (dynamic-string.c:63)
>     by 0x46587B: ds_put_format_valist (dynamic-string.c:161)
>     by 0x465956: ds_put_format (dynamic-string.c:142)
>     by 0x42187F: build_ipv6_input_flows_for_lrouter_port (ovn-northd.c:11188)
>     by 0x42187F: build_lswitch_and_lrouter_iterate_by_op (ovn-northd.c:11279)
>     by 0x42187F: build_lswitch_and_lrouter_flows.constprop.0 (ovn-northd.c:11316)
>     by 0x422503: build_lflows (ovn-northd.c:11398)
>     by 0x42478D: ovnnb_db_run (ovn-northd.c:12334)
>     by 0x42478D: ovn_db_run (ovn-northd.c:12927)
>     by 0x408E84: main (ovn-northd.c:13333)
>
> Fixes: ddf9f1d71319 ("ovn-northd: reorganize processing of lflows")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

Thanks Ilya. I applied this patch to master.

Numan

> ---
>  northd/ovn-northd.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index 8ce756c8a..148d2a051 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -11296,6 +11296,9 @@ build_lswitch_and_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
>      }
>      free(svc_check_match);
>
> +    ds_destroy(&lsi.match);
> +    ds_destroy(&lsi.actions);
> +
>      /* Legacy lswitch build - to be migrated. */
>      build_lswitch_flows(datapaths, ports, lflows, mcgroups,
>                          igmp_groups, lbs);
> --
> 2.25.4
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 8ce756c8a..148d2a051 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -11296,6 +11296,9 @@  build_lswitch_and_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
     }
     free(svc_check_match);
 
+    ds_destroy(&lsi.match);
+    ds_destroy(&lsi.actions);
+
     /* Legacy lswitch build - to be migrated. */
     build_lswitch_flows(datapaths, ports, lflows, mcgroups,
                         igmp_groups, lbs);