This is a backport of commit 1bddcb5dc (ofproto-dpif-xlate: Fix bug that may leak ofproto_flow_mod) from branch-2.8. That commit won't cherry-pick cleanly onto branch-2.7 as the addition of the learn limit in 2.8 changed xlate_learn_action() a lot.
Neutron ml2/ovs uses a learn action to learn from tunnels and the leak can grow to tens of GB after several months. Valgrind after 10K up calls: 575,680 bytes in 8,995 blocks are definitely lost in loss record 373 of 373 malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) xmalloc (util.c:112) miniflow_alloc (flow.c:2500) minimatch_init (match.c:1387) rule_criteria_init (ofproto.c:4060) modify_flow_init_strict (ofproto.c:5431) ofproto_flow_mod_init (ofproto.c:7432) ofproto_flow_mod_init_for_learn (ofproto.c:4988) xlate_learn_action (ofproto-dpif-xlate.c:4417) do_xlate_actions (ofproto-dpif-xlate.c:5359) xlate_recursively (ofproto-dpif-xlate.c:3453) xlate_table_action (ofproto-dpif-xlate.c:3520) xlate_ofpact_resubmit (ofproto-dpif-xlate.c:3810) do_xlate_actions (ofproto-dpif-xlate.c:5248) xlate_recursively (ofproto-dpif-xlate.c:3453) xlate_table_action (ofproto-dpif-xlate.c:3520) xlate_ofpact_resubmit (ofproto-dpif-xlate.c:3810) do_xlate_actions (ofproto-dpif-xlate.c:5248) xlate_actions (ofproto-dpif-xlate.c:5962) upcall_xlate (ofproto-dpif-upcall.c:1132) process_upcall (ofproto-dpif-upcall.c:1269) recv_upcalls.isra.20 (ofproto-dpif-upcall.c:824) udpif_upcall_handler (ofproto-dpif-upcall.c:746) ovsthread_wrapper (ovs-thread.c:348) start_thread (pthread_create.c:333) clone (clone.S:109 Signed-off-by: Darragh O'Reilly <[email protected]> --- ofproto/ofproto-dpif-xlate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index fc7a126ed..5b736709c 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4421,6 +4421,10 @@ xlate_learn_action(struct xlate_ctx *ctx, const struct ofpact_learn *learn) error = ofproto_flow_mod_learn(ofm, ctx->xin->xcache != NULL); } + if (!ctx->xin->xcache) { + ofproto_flow_mod_uninit(ofm); + } + if (error) { xlate_report_error(ctx, "LEARN action execution failed (%s).", ofperr_to_string(error)); -- 2.25.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
