On Tue, May 12, 2020 at 8:07 PM Mark Michelson <[email protected]> wrote:
> Acked-by: Mark Michelson <[email protected]> > Thanks Ilya for the fix and Mark for the reviews. I applied this patch to master. I'll also apply to branch-20.03 in a while. Thanks Numan > > On 5/12/20 6:44 AM, Ilya Maximets wrote: > > 'lrp_networks' never destroyed but constantly overwritten in a loop that > > handles DHCPv6 replies. In some cases this point leaks several MB per > > minute making ovn-northd to constantly growing its memory consumption: > > > > 399,820,764 bytes in 1,885,947 blocks are definitely lost in loss > record 182 of 182 > > at 0x4839748: malloc (vg_replace_malloc.c:308) > > by 0x483BD63: realloc (vg_replace_malloc.c:836) > > by 0x1E7BF8: xrealloc (util.c:149) > > by 0x152723: add_ipv6_netaddr.isra.0 (ovn-util.c:55) > > by 0x152F1C: extract_lrp_networks (ovn-util.c:275) > > by 0x142EE2: build_lrouter_flows (ovn-northd.c:8607) > > by 0x142EE2: build_lflows.isra.0 (ovn-northd.c:10296) > > by 0x14E4F8: ovnnb_db_run (ovn-northd.c:11128) > > by 0x14E4F8: ovn_db_run (ovn-northd.c:11672) > > by 0x13304D: main (ovn-northd.c:12035) > > > > In fact, there is no need to allocate this memory at all, since all the > > required information is already available in 'op->lrp_networks'. > > > > Reported-by: Joe Talerico <[email protected]> > > Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1827769 > > Fixes: 5c1d2d230773 ("northd: Add logical flows for dhcpv6 pfd parsing") > > Signed-off-by: Ilya Maximets <[email protected]> > > --- > > > > Version 2: > > - Changed to not allocate that memory by resusing already parsed > > version from 'op->lrp_networks'. > > - Additional fix for leak on duplicated router port splitted to a > > separate patch. > > > > northd/ovn-northd.c | 9 ++------- > > 1 file changed, 2 insertions(+), 7 deletions(-) > > > > diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c > > index 76b4a14ee..6f7d457a4 100644 > > --- a/northd/ovn-northd.c > > +++ b/northd/ovn-northd.c > > @@ -8607,17 +8607,12 @@ build_lrouter_flows(struct hmap *datapaths, > struct hmap *ports, > > continue; > > } > > > > - struct lport_addresses lrp_networks; > > - if (!extract_lrp_networks(op->nbrp, &lrp_networks)) { > > - continue; > > - } > > - > > - for (size_t i = 0; i < lrp_networks.n_ipv6_addrs; i++) { > > + for (size_t i = 0; i < op->lrp_networks.n_ipv6_addrs; i++) { > > ds_clear(&actions); > > ds_clear(&match); > > ds_put_format(&match, "ip6.dst == %s && udp.src == 547 &&" > > " udp.dst == 546", > > - lrp_networks.ipv6_addrs[i].addr_s); > > + op->lrp_networks.ipv6_addrs[i].addr_s); > > ds_put_format(&actions, "reg0 = 0; handle_dhcpv6_reply;"); > > ovn_lflow_add(lflows, op->od, S_ROUTER_IN_IP_INPUT, 100, > > ds_cstr(&match), ds_cstr(&actions)); > > > > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev > > _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
