Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26463

Memory leak in embedded server bootstrap

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2, 10.3, 10.4, 10.5, 10.6, 10.7
    • None
    • Embedded Server

    Description

      A memory leak on the embedded server bootstrap makes ./mtr --embedded almost useless for AddressSanitizer runs:

      mkdir bld
      cd bld
      cmake -DWITH_EMBEDDED_SERVER=ON -DWITH_ASAN=ON ..
      cmake --build .
      (cd mysql-test; ASAN_OPTIONS=log_path=/dev/shm/10.2-embedded:fast_unwind_on_malloc=0 ./mtr --embedded --parallel=auto)
      

      Note: When the code is compiled with GCC, many tests will pass despite leaks. When compiled with Clang, tests will fail more easily.
      Here is the contents of a sample file /dev/shm/10.2-embedded.*:

      10.2 ca89489716890ebab5b207e49f3b157e78e0f8e4

       
      =================================================================
      ==4111278==ERROR: LeakSanitizer: detected memory leaks
       
      Direct leak of 16400 byte(s) in 1 object(s) allocated from:
          #0 0x7f8decc8c7cf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
          #1 0x55c0ed114981 in my_malloc /mariadb/10.2o/mysys/my_malloc.c:101
          #2 0x55c0ed1b23c2 in net_allocate_new_packet(st_net*, void*, unsigned int) /mariadb/10.2o/sql/net_serv.cc:177
          #3 0x55c0ed1b24be in my_net_init /mariadb/10.2o/sql/net_serv.cc:141
          #4 0x55c0ed13f261 in bootstrap /mariadb/10.2o/libmysqld/../sql/mysqld.cc:6469
          #5 0x55c0ed13f261 in read_init_file /mariadb/10.2o/libmysqld/../sql/mysqld.cc:6509
          #6 0x55c0ed13f261 in init_embedded_server /mariadb/10.2o/libmysqld/lib_sql.cc:636
          #7 0x55c0ed074138 in main /mariadb/10.2o/client/mysqltest.cc:9202
          #8 0x7f8dec1ead09 in __libc_start_main ../csu/libc-start.c:308
          #9 0x55c0ed0adba9 in _start (/dev/shm/10.2o/libmysqld/examples/mysqltest_embedded+0x79cba9)
       
      SUMMARY: AddressSanitizer: 16400 byte(s) leaked in 1 allocation(s).
      

      Similar leaks are reported for 10.5 and 10.6 as well.

      Furthermore, the ./mtr --embedded run of a 10.6 GCC ASAN build would seemingly hang using 100% CPU; sudo perf top -g would attribute 95% of all samples to __asan::AsanDie(). This would happen after only 2 reported test failures, after 4197 tests, 1167 to go. I suspect that it could be related to the bootstrap leak.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.