FRRouting / frr

The FRRouting Protocol Suite
https://frrouting.org/
Other
3.21k stars 1.24k forks source link

ospf spf is leaking memory #12479

Closed donaldsharp closed 1 year ago

donaldsharp commented 1 year ago

Running a large variety of topotests with --enable-address-sanitizer reveals a that ospf is leaking memory:

./bgp_auth.test_bgp_auth3/R1.ospfd.asan.2332846
::::::::::::::
==2353467==Running thread 2332809 was not suspended. False leaks are possible.
==2353467==Running thread 2332811 was not suspended. False leaks are possible.

=================================================================
==2332846==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 6 object(s) allocated from:
    #0 0x4acb12 in calloc (/usr/lib/frr/ospfd+0x4acb12)
    #1 0x7f51ebaf3798 in qcalloc /home/sharpd/frr8/lib/memory.c:116:27
    #2 0x5c0687 in vertex_nexthop_new /home/sharpd/frr8/ospfd/ospf_spf.c:117:9
    #3 0x5c463a in ospf_nexthop_calculation /home/sharpd/frr8/ospfd/ospf_spf.c:1146:10
    #4 0x5babd2 in ospf_spf_next /home/sharpd/frr8/ospfd/ospf_spf.c:1470:8
    #5 0x5b91cf in ospf_spf_calculate /home/sharpd/frr8/ospfd/ospf_spf.c:1737:3
    #6 0x5bd347 in ospf_spf_calculate_area /home/sharpd/frr8/ospfd/ospf_spf.c:1792:2
    #7 0x5bd869 in ospf_spf_calculate_areas /home/sharpd/frr8/ospfd/ospf_spf.c:1825:3
    #8 0x5bf976 in ospf_spf_calculate_schedule_worker /home/sharpd/frr8/ospfd/ospf_spf.c:1886:2
    #9 0x7f51ebc2c7a6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2
    #10 0x7f51eba9a503 in frr_run /home/sharpd/frr8/lib/libfrr.c:1198:3
    #11 0x4dca7e in main /home/sharpd/frr8/ospfd/ospf_main.c:235:2
    #12 0x7f51eb49ed09 in __libc_start_main csu/../csu/libc-start.c:308:16

Direct leak of 32 byte(s) in 4 object(s) allocated from:
    #0 0x4acb12 in calloc (/usr/lib/frr/ospfd+0x4acb12)
    #1 0x7f51ebaf3798 in qcalloc /home/sharpd/frr8/lib/memory.c:116:27
    #2 0x5c0687 in vertex_nexthop_new /home/sharpd/frr8/ospfd/ospf_spf.c:117:9
    #3 0x5c463a in ospf_nexthop_calculation /home/sharpd/frr8/ospfd/ospf_spf.c:1146:10
    #4 0x5bae84 in ospf_spf_next /home/sharpd/frr8/ospfd/ospf_spf.c:1490:5
    #5 0x5b91cf in ospf_spf_calculate /home/sharpd/frr8/ospfd/ospf_spf.c:1737:3
    #6 0x5bd347 in ospf_spf_calculate_area /home/sharpd/frr8/ospfd/ospf_spf.c:1792:2
    #7 0x5bd869 in ospf_spf_calculate_areas /home/sharpd/frr8/ospfd/ospf_spf.c:1825:3
    #8 0x5bf976 in ospf_spf_calculate_schedule_worker /home/sharpd/frr8/ospfd/ospf_spf.c:1886:2
    #9 0x7f51ebc2c7a6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2
    #10 0x7f51eba9a503 in frr_run /home/sharpd/frr8/lib/libfrr.c:1198:3
    #11 0x4dca7e in main /home/sharpd/frr8/ospfd/ospf_main.c:235:2
    #12 0x7f51eb49ed09 in __libc_start_main csu/../csu/libc-start.c:308:16

SUMMARY: AddressSanitizer: 80 byte(s) leaked in 10 allocation(s).

In this case this is from bgp_auth topotest. But the traceback is visible in a bunch of topotests

donaldsharp commented 1 year ago

ldp_sync_ospf_topo1 bgp_evpn_vxlan_topo1 ospf_basic_functionality ldp_oc_acl_topo1 bgp_auth bgp_rfapi_basic_sanity msdp_mesh_topo1 multicast_pim_dr_nondr_test bgp_l3vpn_to_bgp_direct ospfapi bgp_instance_del ospf_te_topo1

there are more