Possible memory leaks

Bug #1187501 reported by Raghavendra D Prabhu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
New
Undecided
Unassigned
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC
Invalid
Undecided
Unassigned

Bug Description

Excerpt from what I noticed during a valgrind run: (valgrind --tool=memcheck --leak-check=full --show-reachable=yes)

a)

==00:00:04:49.304 43673== 5 bytes in 1 blocks are definitely lost in loss record 2 of 18
==00:00:04:49.304 43673== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:04:49.304 43673== by 0x8087AC: my_malloc (my_malloc.c:38)
==00:00:04:49.304 43673== by 0x808B3F: my_strdup (my_malloc.c:152)
==00:00:04:49.304 43673== by 0x685787: wsrep_init_vars() (wsrep_var.cc:48)
==00:00:04:49.304 43673== by 0x51E92D: mysqld_main(int, char**) (mysqld.cc:7927)
==00:00:04:49.304 43673== by 0x514628: main (main.cc:25)

--- the variables allotted in wsrep_init_vars are not freed.

b)

==00:00:04:49.304 43673== 7 bytes in 1 blocks are definitely lost in loss record 3 of 18
==00:00:04:49.304 43673== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:04:49.304 43673== by 0x8087AC: my_malloc (my_malloc.c:38)
==00:00:04:49.304 43673== by 0x808B3F: my_strdup (my_malloc.c:152)
==00:00:04:49.304 43673== by 0x51EA9E: mysqld_main(int, char**) (mysqld.cc:3294)
==00:00:04:49.304 43673== by 0x514628: main (main.cc:25)

--- Again similar with wsrep_node_address

(Note a and b may be fine since variables are alive till the end)

c)

==00:00:04:49.304 43673== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:04:49.304 43673== by 0x659A969: strdup (in /usr/lib/libc-2.17.so)
==00:00:04:49.304 43673== by 0x680A7D: sst_auth_real_set(char const*) (wsrep_sst.cc:119)
==00:00:04:49.304 43673== by 0x6824C4: wsrep_sst_auth_init(char const*) (wsrep_sst.cc:152)
==00:00:04:49.304 43673== by 0x516D1A: mysqld_get_one_option (mysqld.cc:8155)
==00:00:04:49.304 43673== by 0x807035: handle_options (my_getopt.c:738)
==00:00:04:49.304 43673== by 0x51EBD5: mysqld_main(int, char**) (mysqld.cc:8302)
==00:00:04:49.304 43673== by 0x514628: main (main.cc:25)

---- Lot of strdups, may need to be checked.

d)

==00:00:04:49.304 43673== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:04:49.304 43673== by 0x400ABC3: _dl_new_object (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x4006443: _dl_map_object_from_fd (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x4008224: _dl_map_object (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x400C3E1: openaux (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x400E913: _dl_catch_error (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x400C644: _dl_map_object_deps (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x4012A12: dl_open_worker (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x400E913: _dl_catch_error (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x401244A: _dl_open (in /usr/lib/ld-2.17.so)
==00:00:04:49.304 43673== by 0x569E02A: ??? (in /usr/lib/libdl-2.17.so)
==00:00:04:49.304 43673== by 0x400E913: _dl_catch_error (in /usr/lib/ld-2.17.so)

---- a false positive IMO, will need to be added to suppressions.

e)

==00:00:04:49.308 43673== at 0x4C29E84: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:04:49.308 43673== by 0x569E63F: ??? (in /usr/lib/libdl-2.17.so)
==00:00:04:49.308 43673== by 0x569E0C0: dlopen (in /usr/lib/libdl-2.17.so)
==00:00:04:49.308 43673== by 0xAA99A1: wsrep_load (wsrep_loader.c:141)
==00:00:04:49.308 43673== by 0x67D87D: wsrep_init() (wsrep_mysqld.cc:422)
==00:00:04:49.308 43673== by 0x67E90B: wsrep_init_startup(bool) (wsrep_mysqld.cc:577)
==00:00:04:49.308 43673== by 0x51AC3E: init_server_components() (mysqld.cc:4040)
==00:00:04:49.308 43673== by 0x520180: mysqld_main(int, char**) (mysqld.cc:5369)
==00:00:04:49.308 43673== by 0x514628: main (main.cc:25)

---- a false positive again, will need to be added to suppressions.

f)

==00:00:04:49.308 43673== at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:00:04:49.308 43673== by 0x5B72C5F: CRYPTO_malloc (in /usr/lib/libcrypto.so.1.0.0)
==00:00:04:49.308 43673== by 0x5C1A35E: sk_new (in /usr/lib/libcrypto.so.1.0.0)
==00:00:04:49.308 43673== by 0x58EA509: load_builtin_compressions (in /usr/lib/libssl.so.1.0.0)
==00:00:04:49.308 43673== by 0x58ECA58: SSL_COMP_get_compression_methods (in /usr/lib/libssl.so.1.0.0)
==00:00:04:49.308 43673== by 0x58F2845: SSL_library_init (in /usr/lib/libssl.so.1.0.0)
==00:00:04:49.308 43673== by 0x79FD8ED: asio::ssl::detail::openssl_init<true>::do_init::instance() (openssl_init.hpp:47)
==00:00:04:49.308 43673== by 0x79576EB: _GLOBAL__sub_I_protonet.cpp (openssl_init.hpp:120)
==00:00:04:49.308 43673== by 0x400EA99: call_init (in /usr/lib/ld-2.17.so)
==00:00:04:49.308 43673== by 0x400EB6B: _dl_init (in /usr/lib/ld-2.17.so)
==00:00:04:49.308 43673== by 0x4012BD4: dl_open_worker (in /usr/lib/ld-2.17.so)
==00:00:04:49.308 43673== by 0x400E913: _dl_catch_error (in /usr/lib/ld-2.17.so)

I saw following in openssl_init.hpp:

    ~do_init()
    {
      if (Do_Init)
      {
        ::CRYPTO_set_id_callback(0);
        ::CRYPTO_set_locking_callback(0);
        ::ERR_free_strings();
        ::ERR_remove_state(0);
        ::EVP_cleanup();
        ::CRYPTO_cleanup_all_ex_data();
        ::CONF_modules_unload(1);
        ::ENGINE_cleanup();
      }
    }

but it still shows the leak, may be a false positive or Do_Init is not true there?

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

This is handled elswhere.

Changed in percona-xtradb-cluster:
status: New → Invalid
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXC-1366

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.