Project

General

Profile

Actions

Bug #5185

closed

possible memleak: "Indirect leak of 22800 byte(s) in 228 object(s) allocated from [...] _talloc_memdup"

Added by neels almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
-
Start date:
06/16/2021
Due date:
% Done:

0%

Spec Reference:

Description

running ttcn3-bsc-tests locally, osmo-stp compiled with asan, when I ctrl-c osmo-stp after a while, i often get:

=================================================================
==2538==ERROR: LeakSanitizer: detected memory leaks

[...]

Indirect leak of 22800 byte(s) in 228 object(s) allocated from:
    #0 0x7fbb4d20d330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7fbb4cdc7776 in _talloc_memdup (/lib/x86_64-linux-gnu/libtalloc.so.2+0x9776)

Related issues

Related to OsmoSTP - Bug #5184: possible memleak: "Indirect leak of 44688 byte(s) in 342 object(s) allocated from [...] _talloc_zero"Closed06/16/2021

Actions
Actions #1

Updated by neels almost 3 years ago

  • Related to Bug #5184: possible memleak: "Indirect leak of 44688 byte(s) in 342 object(s) allocated from [...] _talloc_zero" added
Actions #2

Updated by neels almost 3 years ago

here the output of another instance of this leak:

=================================================================
==2673==ERROR: LeakSanitizer: detected memory leaks

[...]

Indirect leak of 36000 byte(s) in 360 object(s) allocated from:
    #0 0x7f3493add330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7f3493696776 in _talloc_memdup (/lib/x86_64-linux-gnu/libtalloc.so.2+0x9776)

The fact that the numbers are different for differing running time seems to confirm that this is an actual leak.

Actions #3

Updated by neels almost 3 years ago

added a talloc report to Ctrl-C in osmo-stp and got this after running a few ttcn3-bsc-tests:

20210620232109207 DLSS7 <000c> ../../../src/libosmocore/src/fsm.c:573 XUA_ASP(asp-dyn-1){ASP_DOWN}: Deallocated
^Csignal 2 received
talloc report on 'vty' (total 134459 bytes in 7217 blocks)
    Configure SCCP timer values, see ITU-T Q.714
Waiting for connection confirm message, 1 to 2 minutes (default: 60)
Send keep-alive: on an idle connection, delay before sending an Idle Timer message, 5 to 10 minutes (default: 420)
Receive keep-alive: on an idle connection, delay until considering a connection as stale, 11 to 21 minutes (default: 900)
Waiting for release complete message, 10 to 20 seconds (default: 10)
Waiting for release complete message; or to repeat sending released message after the initial expiry, 10 to 20 seconds (default: 10)
Waiting for release complete message; or to release connection resources, freeze the LRN and alert a maintenance function after the initial expiry, extending to 1 minute (default: 60)
Waiting to resume normal procedure for temporary connection sections during the restart procedure, 23 to 25 minutes (default: 1380)
Waiting to release temporary connection section or alert maintenance function after reset request message is sent, 10 to 20 seconds (default: 10)
Waiting to receive all the segments of the remaining segments, single segmented message after receiving the first segment, 10 to 20 seconds (default: 10)
Timer value, in seconds
 contains   1194 bytes in   1 blocks (ref 0) 0x61a0000006e0
    sccp-timer (conn_est|ias|iar|rel|repeat_rel|int|guard|reset|reassembly) <1-999999> contains     83 bytes in   1 blocks (ref 0) 0x6100000011a0
    save_cwd                       contains     46 bytes in   1 blocks (ref 0) 0x60d000002530
    vty_command                    contains  82864 bytes in 4310 blocks (ref 0) 0x608000000280
    vty_vector                     contains  50272 bytes in 2903 blocks (ref 0) 0x608000000200
full talloc report on 'osmo-stp' (total  14206 bytes in 107 blocks)
    telnet_connection              contains      1 bytes in   1 blocks (ref 0) 0x60b000129200
    struct osmo_ss7_instance       contains   9437 bytes in  88 blocks (ref 0) 0x614000001aa0
        struct osmo_xua_server         contains    678 bytes in   4 blocks (ref 0) 0x6140000020a0
            ::                             contains      3 bytes in   1 blocks (ref 0) 0x60b000128ff0
            struct osmo_stream_srv_link    contains    339 bytes in   2 blocks (ref 0) 0x6140000022a0
                ::                             contains      3 bytes in   1 blocks (ref 0) 0x60b0001290a0
        struct osmo_xua_server         contains    678 bytes in   4 blocks (ref 0) 0x614000001ca0
            ::                             contains      3 bytes in   1 blocks (ref 0) 0x60b0001289c0
            struct osmo_stream_srv_link    contains    339 bytes in   2 blocks (ref 0) 0x614000001ea0
                ::                             contains      3 bytes in   1 blocks (ref 0) 0x60b000128a70
        struct osmo_ss7_as             contains    600 bytes in   7 blocks (ref 0) 0x613000008920
            virt-smlc                      contains     10 bytes in   1 blocks (ref 0) 0x60b000124870
            struct osmo_fsm_inst           contains    340 bytes in   4 blocks (ref 0) 0x612000001ea0
                struct xua_as_fsm_priv         contains    112 bytes in   1 blocks (ref 0) 0x611000006ae0
                XUA_AS(virt-smlc)              contains     18 bytes in   1 blocks (ref 0) 0x60c000032320
                virt-smlc                      contains     10 bytes in   1 blocks (ref 0) 0x60b0001247c0
            virt-smlc                      contains     10 bytes in   1 blocks (ref 0) 0x60b000124710
        struct osmo_ss7_asp            contains   1134 bytes in   9 blocks (ref 0) 0x618000004ce0
            (r=::ffff:127.0.0.1:23908<->l=::ffff:127.0.0.1:2905) contains     53 bytes in   1 blocks (ref 0) 0x60e000032ca0
            struct osmo_fsm_inst           contains    337 bytes in   4 blocks (ref 0) 0x612000001d20
                struct xua_asp_fsm_priv        contains    104 bytes in   1 blocks (ref 0) 0x6110000069a0
                XUA_ASP(virt-smlc-0)           contains     21 bytes in   1 blocks (ref 0) 0x60c000032260
                virt-smlc-0                    contains     12 bytes in   1 blocks (ref 0) 0x60b0001245b0
            127.0.0.1                      contains     10 bytes in   1 blocks (ref 0) 0x60b000124030
            127.0.0.1                      contains     10 bytes in   1 blocks (ref 0) 0x60b000123ab0
            virt-smlc-0                    contains     12 bytes in   1 blocks (ref 0) 0x60b000123480
        struct osmo_ss7_as             contains    600 bytes in   7 blocks (ref 0) 0x613000007ce0
            virt-msc2                      contains     10 bytes in   1 blocks (ref 0) 0x60b000122140
            struct osmo_fsm_inst           contains    340 bytes in   4 blocks (ref 0) 0x612000001ba0
                struct xua_as_fsm_priv         contains    112 bytes in   1 blocks (ref 0) 0x611000006860
                XUA_AS(virt-msc2)              contains     18 bytes in   1 blocks (ref 0) 0x60c000031f60
                virt-msc2                      contains     10 bytes in   1 blocks (ref 0) 0x60b000122090
            virt-msc2                      contains     10 bytes in   1 blocks (ref 0) 0x60b000121fe0
        struct osmo_ss7_asp            contains   1081 bytes in   8 blocks (ref 0) 0x6180000048e0
            struct osmo_fsm_inst           contains    337 bytes in   4 blocks (ref 0) 0x612000001a20
                struct xua_asp_fsm_priv        contains    104 bytes in   1 blocks (ref 0) 0x611000006720
                XUA_ASP(virt-msc2-0)           contains     21 bytes in   1 blocks (ref 0) 0x60c000031ea0
                virt-msc2-0                    contains     12 bytes in   1 blocks (ref 0) 0x60b000121e80
            127.0.0.1                      contains     10 bytes in   1 blocks (ref 0) 0x60b000121900
            127.0.0.1                      contains     10 bytes in   1 blocks (ref 0) 0x60b000121380
            virt-msc2-0                    contains     12 bytes in   1 blocks (ref 0) 0x60b000120d50
        struct osmo_ss7_as             contains    600 bytes in   7 blocks (ref 0) 0x6130000070a0
            virt-msc1                      contains     10 bytes in   1 blocks (ref 0) 0x60b0000bda90
            struct osmo_fsm_inst           contains    340 bytes in   4 blocks (ref 0) 0x6120000018a0
                struct xua_as_fsm_priv         contains    112 bytes in   1 blocks (ref 0) 0x6110000065e0
                XUA_AS(virt-msc1)              contains     18 bytes in   1 blocks (ref 0) 0x60c000031ba0
                virt-msc1                      contains     10 bytes in   1 blocks (ref 0) 0x60b0000bd9e0
            virt-msc1                      contains     10 bytes in   1 blocks (ref 0) 0x60b0000bd930
        struct osmo_ss7_asp            contains   1081 bytes in   8 blocks (ref 0) 0x6180000044e0
            struct osmo_fsm_inst           contains    337 bytes in   4 blocks (ref 0) 0x612000001720
                struct xua_asp_fsm_priv        contains    104 bytes in   1 blocks (ref 0) 0x6110000064a0
                XUA_ASP(virt-msc1-0)           contains     21 bytes in   1 blocks (ref 0) 0x60c000031ae0
                virt-msc1-0                    contains     12 bytes in   1 blocks (ref 0) 0x60b00011ff90
            127.0.0.1                      contains     10 bytes in   1 blocks (ref 0) 0x60b00011fa10
            127.0.0.1                      contains     10 bytes in   1 blocks (ref 0) 0x60b00011f490
            virt-msc1-0                    contains     12 bytes in   1 blocks (ref 0) 0x60b00011ee60
        struct osmo_ss7_as             contains    600 bytes in   7 blocks (ref 0) 0x613000006460
            virt-msc0                      contains     10 bytes in   1 blocks (ref 0) 0x60b00011db20
            struct osmo_fsm_inst           contains    340 bytes in   4 blocks (ref 0) 0x6120000015a0
                struct xua_as_fsm_priv         contains    112 bytes in   1 blocks (ref 0) 0x611000006360
                XUA_AS(virt-msc0)              contains     18 bytes in   1 blocks (ref 0) 0x60c0000317e0
                virt-msc0                      contains     10 bytes in   1 blocks (ref 0) 0x60b00011da70
            virt-msc0                      contains     10 bytes in   1 blocks (ref 0) 0x60b00011d9c0
        struct osmo_ss7_as             contains    596 bytes in   7 blocks (ref 0) 0x613000005d60
            mahlzeit                       contains      9 bytes in   1 blocks (ref 0) 0x60b00011c730
            struct osmo_fsm_inst           contains    338 bytes in   4 blocks (ref 0) 0x612000001420
                struct xua_as_fsm_priv         contains    112 bytes in   1 blocks (ref 0) 0x611000006220
                XUA_AS(mahlzeit)               contains     17 bytes in   1 blocks (ref 0) 0x60c0000314e0
                mahlzeit                       contains      9 bytes in   1 blocks (ref 0) 0x60b00011c680
            mahlzeit                       contains      9 bytes in   1 blocks (ref 0) 0x60b00011c5d0
        struct osmo_ss7_asp            contains   1134 bytes in   9 blocks (ref 0) 0x6180000040e0
            (r=::ffff:127.0.0.1:23905<->l=::ffff:127.0.0.1:2905) contains     53 bytes in   1 blocks (ref 0) 0x60e000032bc0
            struct osmo_fsm_inst           contains    337 bytes in   4 blocks (ref 0) 0x6120000012a0
                struct xua_asp_fsm_priv        contains    104 bytes in   1 blocks (ref 0) 0x6110000060e0
                XUA_ASP(virt-msc0-0)           contains     21 bytes in   1 blocks (ref 0) 0x60c000031420
                virt-msc0-0                    contains     12 bytes in   1 blocks (ref 0) 0x60b00011c470
            127.0.0.1                      contains     10 bytes in   1 blocks (ref 0) 0x60b00011bef0
            127.0.0.1                      contains     10 bytes in   1 blocks (ref 0) 0x60b00011b970
            virt-msc0-0                    contains     12 bytes in   1 blocks (ref 0) 0x60b00011b340
        struct osmo_ss7_route_table    contains    359 bytes in  10 blocks (ref 0) 0x60e0000310a0
            struct osmo_ss7_route          contains     74 bytes in   2 blocks (ref 0) 0x60e000031b20
                virt-smlc                      contains     10 bytes in   1 blocks (ref 0) 0x60b000127aa0
            struct osmo_ss7_route          contains     74 bytes in   2 blocks (ref 0) 0x60e000031960
                virt-msc2                      contains     10 bytes in   1 blocks (ref 0) 0x60b000127260
            struct osmo_ss7_route          contains     74 bytes in   2 blocks (ref 0) 0x60e0000317a0
                virt-msc1                      contains     10 bytes in   1 blocks (ref 0) 0x60b000126a20
            struct osmo_ss7_route          contains     74 bytes in   2 blocks (ref 0) 0x60e0000315e0
                virt-msc0                      contains     10 bytes in   1 blocks (ref 0) 0x60b0001261e0
            system                         contains      7 bytes in   1 blocks (ref 0) 0x60b00011a630
    struct sched_vty_opts          contains     72 bytes in   1 blocks (ref 0) 0x60f000001540
    ../../../../src/libosmocore/src/vty/utils.c:348 contains    203 bytes in   1 blocks (ref 0) 0x612000000fa0
    ../../../../src/libosmocore/src/vty/utils.c:348 contains     46 bytes in   1 blocks (ref 0) 0x60d000013d80
    ../../../../src/libosmocore/src/vty/utils.c:348 contains    165 bytes in   1 blocks (ref 0) 0x612000000e20
    ../../../../src/libosmocore/src/vty/utils.c:348 contains     43 bytes in   1 blocks (ref 0) 0x60d000013cb0
    logging                        contains   4238 bytes in  11 blocks (ref 0) 0x60b0000002b0
        vty_logp_doc_str               contains    998 bytes in   1 blocks (ref 0) 0x619000000ae0
        vty_logp_cmd_str               contains    189 bytes in   1 blocks (ref 0) 0x612000000ca0
        vty_log_level_doc_str          contains    791 bytes in   1 blocks (ref 0) 0x6180000024e0
        vty_log_level_cmd_str          contains    165 bytes in   1 blocks (ref 0) 0x612000000820
        vty_log_level_doc_str          contains    926 bytes in   1 blocks (ref 0) 0x6190000000e0
        vty_log_level_cmd_str          contains    186 bytes in   1 blocks (ref 0) 0x6120000003a0
        struct log_target              contains    206 bytes in   2 blocks (ref 0) 0x6110000001e0
            struct log_category            contains     46 bytes in   1 blocks (ref 0) 0x60d000000170
        struct log_info                contains    776 bytes in   2 blocks (ref 0) 0x60d0000000a0
            struct log_info_cat            contains    736 bytes in   1 blocks (ref 0) 0x6180000000e0
    msgb                           contains      0 bytes in   1 blocks (ref 0) 0x608000000100

=================================================================
==10439==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 18816 byte(s) in 144 object(s) allocated from:
    #0 0x7f74671d1330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7f7466d8a140 in _talloc_zero (/lib/x86_64-linux-gnu/libtalloc.so.2+0x9140)

Indirect leak of 9600 byte(s) in 96 object(s) allocated from:
    #0 0x7f74671d1330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    #1 0x7f7466d8a776 in _talloc_memdup (/lib/x86_64-linux-gnu/libtalloc.so.2+0x9776)

SUMMARY: AddressSanitizer: 28416 byte(s) leaked in 240 allocation(s).
Actions #4

Updated by neels almost 3 years ago

in above talloc report, no entries match the numbers reported in the leaks.
are we allocating things on NULL? are we detaching tallocs from their parents?
i tried to grep around a little bit but didn't find anything yet.

Actions #5

Updated by laforge almost 3 years ago

  • Assignee set to Hoernchen
Actions #6

Updated by Hoernchen almost 3 years ago

Most likely fixed by https://gerrit.osmocom.org/c/libosmo-sccp/+/24909 - at least my asan is happy.

Actions #7

Updated by Hoernchen almost 3 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)