KEMBAR78
[Bug]: aclk memory leak · Issue #21083 · netdata/netdata · GitHub
Skip to content

[Bug]: aclk memory leak #21083

@ktsaou

Description

@ktsaou

Bug description

=================================================================
==508058==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 29 byte(s) in 1 object(s) allocated from:
    #0 0x7f3ea391a42a in strdup /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:593
    #1 0x55c8ac297c30 in strdupz /home/costa/src/netdata-ktsaou.git/src/libnetdata/memory/nd-mallocz.c:428
    #2 0x55c8ab91bec1 in process_http_hdr /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:217
    #3 0x55c8ab91c812 in parse_http_hdr /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:269
    #4 0x55c8ab91e6ea in parse_http_response /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:420
    #5 0x55c8ab9202c1 in read_parse_response /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:623
    #6 0x55c8ab9211ea in handle_http_request /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:710
    #7 0x55c8ab922c95 in https_request /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:880
    #8 0x55c8abc9b561 in aclk_https_request /home/costa/src/netdata-ktsaou.git/src/aclk/aclk_otp.c:28
    #9 0x55c8abc9d92b in aclk_send_otp_response /home/costa/src/netdata-ktsaou.git/src/aclk/aclk_otp.c:384
    #10 0x55c8abc9e5f9 in aclk_get_mqtt_otp /home/costa/src/netdata-ktsaou.git/src/aclk/aclk_otp.c:498
    #11 0x55c8ab8fb762 in aclk_attempt_to_connect /home/costa/src/netdata-ktsaou.git/src/aclk/aclk.c:706
    #12 0x55c8ab8fc85a in aclk_main /home/costa/src/netdata-ktsaou.git/src/aclk/aclk.c:887
    #13 0x55c8ac04124d in nd_thread_starting_point /home/costa/src/netdata-ktsaou.git/src/libnetdata/threads/threads.c:367
    #14 0x7f3ea385e11a in asan_thread_start /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:239
    #15 0x7f3ea1e969ca  (/usr/lib/libc.so.6+0x969ca) (BuildId: 4fe011c94a88e8aeb6f2201b9eb369f42b4a1e9e)

Direct leak of 29 byte(s) in 1 object(s) allocated from:
    #0 0x7f3ea391a42a in strdup /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:593
    #1 0x55c8ac297c30 in strdupz /home/costa/src/netdata-ktsaou.git/src/libnetdata/memory/nd-mallocz.c:428
    #2 0x55c8ab91bec1 in process_http_hdr /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:217
    #3 0x55c8ab91c812 in parse_http_hdr /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:269
    #4 0x55c8ab91e6ea in parse_http_response /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:420
    #5 0x55c8ab9202c1 in read_parse_response /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:623
    #6 0x55c8ab9211ea in handle_http_request /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:710
    #7 0x55c8ab922c95 in https_request /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:880
    #8 0x55c8abc9b561 in aclk_https_request /home/costa/src/netdata-ktsaou.git/src/aclk/aclk_otp.c:28
    #9 0x55c8abc9cbd3 in aclk_get_otp_challenge /home/costa/src/netdata-ktsaou.git/src/aclk/aclk_otp.c:294
    #10 0x55c8abc9e31a in aclk_get_mqtt_otp /home/costa/src/netdata-ktsaou.git/src/aclk/aclk_otp.c:479
    #11 0x55c8ab8fb762 in aclk_attempt_to_connect /home/costa/src/netdata-ktsaou.git/src/aclk/aclk.c:706
    #12 0x55c8ab8fc85a in aclk_main /home/costa/src/netdata-ktsaou.git/src/aclk/aclk.c:887
    #13 0x55c8ac04124d in nd_thread_starting_point /home/costa/src/netdata-ktsaou.git/src/libnetdata/threads/threads.c:367
    #14 0x7f3ea385e11a in asan_thread_start /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:239
    #15 0x7f3ea1e969ca  (/usr/lib/libc.so.6+0x969ca) (BuildId: 4fe011c94a88e8aeb6f2201b9eb369f42b4a1e9e)

Direct leak of 29 byte(s) in 1 object(s) allocated from:
    #0 0x7f3ea391a42a in strdup /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:593
    #1 0x55c8ac297c30 in strdupz /home/costa/src/netdata-ktsaou.git/src/libnetdata/memory/nd-mallocz.c:428
    #2 0x55c8ab91bec1 in process_http_hdr /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:217
    #3 0x55c8ab91c812 in parse_http_hdr /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:269
    #4 0x55c8ab91e6ea in parse_http_response /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:420
    #5 0x55c8ab9202c1 in read_parse_response /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:623
    #6 0x55c8ab9211ea in handle_http_request /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:710
    #7 0x55c8ab922c95 in https_request /home/costa/src/netdata-ktsaou.git/src/aclk/https_client.c:880
    #8 0x55c8abc9b561 in aclk_https_request /home/costa/src/netdata-ktsaou.git/src/aclk/aclk_otp.c:28
    #9 0x55c8abca0ef9 in aclk_get_env /home/costa/src/netdata-ktsaou.git/src/aclk/aclk_otp.c:825
    #10 0x55c8ab8fb367 in aclk_attempt_to_connect /home/costa/src/netdata-ktsaou.git/src/aclk/aclk.c:668
    #11 0x55c8ab8fc85a in aclk_main /home/costa/src/netdata-ktsaou.git/src/aclk/aclk.c:887
    #12 0x55c8ac04124d in nd_thread_starting_point /home/costa/src/netdata-ktsaou.git/src/libnetdata/threads/threads.c:367
    #13 0x7f3ea385e11a in asan_thread_start /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_interceptors.cpp:239
    #14 0x7f3ea1e969ca  (/usr/lib/libc.so.6+0x969ca) (BuildId: 4fe011c94a88e8aeb6f2201b9eb369f42b4a1e9e)

SUMMARY: AddressSanitizer: 87 byte(s) leaked in 3 allocation(s).

Expected behavior

Not to leak memory.

Steps to reproduce

  1. Compile with ASAN and leak-checker
  2. Start Netdata from the command line
  3. Wait for ACLK to connect
  4. Stop Netdata with control-C
  5. ASAN reports the leak

Installation method

kickstart.sh

System info

irrelevant

Netdata build info

latest nightly

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds triageIssues which need to be manually labelled

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions