Project

General

Profile

Actions

Bug #6222

closed

Memory leak triggered by stream_test

Added by pespin 6 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
arehbein
Target version:
-
Start date:
10/17/2023
Due date:
% Done:

100%

Spec Reference:

Description

Building libosmo-netif master (106b63907a1d9be56bce7cb4a830b4bf52e7ab51), stream_test fails with ASan enabled:

 CLICONN(,r=127.0.0.11:1111<->l=127.0.0.1:8977){CONNECTING} connection established
 SRV(srv_link_test,127.0.0.11:1112) accept()ed new link from 127.0.0.1:8977
 CLICONN(,r=127.0.0.11:1112<->l=127.0.0.1:8977){CONNECTING} connection established
+
+=================================================================
+==235742==ERROR: LeakSanitizer: detected memory leaks
+
+Direct leak of 96 byte(s) in 1 object(s) allocated from:
+    #0 0x7fa93c0e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
+    #1 0x7fa93c6eca76  (/usr/lib/libtalloc.so.2+0x4a76) (BuildId: e0a2f614bd7ebca36cf8a6c88cb544b680fd17dd)
+
+Indirect leak of 96 byte(s) in 1 object(s) allocated from:
+    #0 0x7fa93c0e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
+    #1 0x7fa93c6ecb04  (/usr/lib/libtalloc.so.2+0x4b04) (BuildId: e0a2f614bd7ebca36cf8a6c88cb544b680fd17dd)
+
+Indirect leak of 96 byte(s) in 1 object(s) allocated from:
+    #0 0x7fa93c0e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
+    #1 0x7fa93c6eca76  (/usr/lib/libtalloc.so.2+0x4a76) (BuildId: e0a2f614bd7ebca36cf8a6c88cb544b680fd17dd)
+
+SUMMARY: AddressSanitizer: 288 byte(s) leaked in 3 allocation(s).
--- expout      2023-10-17 16:22:21.289194482 +0200
+++ /build/new/tmpdir/libosmo-netif/tests/testsuite.dir/at-groups/1/stdout     2023-10-17 16:22:22.165868993 +0200
@@ -173,17 +173,4 @@
 {20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      msg buff data: 04 01 01
 {20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      IPA payload: 04 01 01
 {20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      Type: IPAC_MSGT_ID_GET
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      (msg dump (including stripped headers): 00 03 fe 04 01 01 )
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb(): [6-cli] Received message from stream (len = 1)
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      msg buff data: 01
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      IPA payload: 01
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      Type: IPAC_MSGT_PONG
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      (msg dump (including stripped headers): 00 01 fe 01 )
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb(): [7-cli] Received message from stream (len = 1)
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      msg buff data: 01
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      IPA payload: 01
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      Type: IPAC_MSGT_PONG
-{20.625033} [OK] Client's test_segm_ipa_stream_cli_cli_read_cb():      (msg dump (including stripped headers): 00 01 fe 01 )
-==================================Test test_segm_ipa_stream_cli complete========================================
-
-Stream tests completed
+{20.625033} [OK] Cl
\ No newline at end of file
/git/libosmo-netif/tests/testsuite.at:8: exit code was 1, expected 0
1. testsuite.at:4: 1. stream_test (testsuite.at:4): FAILED (testsuite.at:8)

Building with flags:

            opt_enable="--enable-sanitize" 
            export DISTCHECK_CONFIGURE_FLAGS="$opt_enable" 
            export CPPFLAGS="-ggdb3 -Og -fno-omit-frame-pointer" #-Wsign-compare -Werror=old-style-definition
            export CFLAGS="-ggdb3 -Og -fno-omit-frame-pointer" #-Werror=old-style-definition
            export CXXFLAGS="-ggdb3 -Og -fno-omit-frame-pointer" 
            opt_enable="$opt_enable --disable-doxygen --enable-werror" 


Related issues

Blocks libosmo-netif - Feature #5753: io_uring support in libosmo-netifResolvedHoernchen11/09/2022

Actions
Actions #1

Updated by pespin 6 months ago

Actions #2

Updated by arehbein 6 months ago

  • % Done changed from 0 to 80

This is probably it; I am also working on compiling it with the flags you gave me to see if it fails

https://gerrit.osmocom.org/c/libosmo-netif/+/34793

Actions #3

Updated by arehbein 6 months ago

  • Status changed from New to Feedback
  • % Done changed from 80 to 90

I reorganized the memory management and cleared up a lot of dangling memory, the talloc report printed only one open byte with both patches applied and I get no LeakSanitizer warnings. I didn't include it in the test code because mem addresses don't seem to be reliably the same for my local machine and the Jenkins build job.

https://gerrit.osmocom.org/c/libosmo-netif/+/34799

https://gerrit.osmocom.org/c/libosmo-netif/+/34793

Actions #4

Updated by arehbein 6 months ago

  • Status changed from Feedback to Resolved
  • % Done changed from 90 to 100
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)