Hi,

We noticed a possible memory leak in netdev_tc_init_flow_api()
as we allocate memory for meter_police_ids with id_pool_create()
but we never destroy it.

I added a code to refcount netdev_tc_init_flow_api and so in
netdev_tc_uninit_flow_api() to destroy it and noticed some behavior
about ovs-system.

As soon as a user adds first bridge "bridge1" the system actually adds
ovs-system as port0 and bridge1 as port1.

Now stopping ovs-vswitchd removes all bridges in order and ovs-system
first. but removing the bridge1 doesn't expilicit removes ovs-system
and stopping ovs-vswitchd also doesn't try to remove it.
Re-adding - removing bridge1 in a loop shows ovs-system being added all the
time just the code returns as the bridge already added but never removed.

In this behavior on purpose? it doesn't seem consistent if we stop
ovs-vswitchd while bridges exists as then ovs-system being removed.

So to fix the memory leak beside the addition of the refcount when to
allocate meter pool and on last refcount to destroy it will need a fix for
ovs-system to be also removed when removing last user added bridge.

If the behavior is on purpose for ovs-system then maybe skip allocating
meter ids pool for ovs-system and do it on first user bridge as it will
probably always exists as ovs-system being added when user adds first bridge.
then removing user bridge will reach last refcount and destroy
the meter pool ids.

what do you think?

Another thing I noticed is valgrind doesn't detect the memory leak of
meter_police_ids. Though adding another duplicate allocation with a new
name is cought by valgrind. Not sure why.

Thanks,
Roi
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to