Skip to content

Commit

Permalink
Partial fix for ASAN hang in mysqltest.cc
Browse files Browse the repository at this point in the history
There seem to be 2 ASAN issues using mysqltest.cc (at least
using test binlog.binlog_autocommit_off_no_hang):

 1. (Fixed by this test) cur_con is not NULLed when freeing
    connections. At backtrace time, it can be read (though
    the backtrace is likely caused by point 2).

 2. (Still to be fixed) There is a leak in mariadb_lib.c line 3863:

```
      OPT_SET_EXTENDED_VALUE(&mysql->options, tls_verification_callback, arg1);
```

    with stack
=================================================================
==288928==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1568 byte(s) in 4 object(s) allocated from:
    #0 0x5ceaa4ebad7d in calloc (./server/build116_asan/client/mariadb-test+0x1dcd7d) (BuildId: 21b3097a37beada873a1eaa15c1ea1f16d3ad6d7)
    #1 0x5ceaa4f6457f in mysql_optionsv ./server/libmariadb/libmariadb/mariadb_lib.c:3863:7
    #2 0x5ceaa4f698fd in mysql_init ./server/libmariadb/libmariadb/mariadb_lib.c:1320:3
    #3 0x5ceaa4f5a06f in mariadb_reconnect ./server/libmariadb/libmariadb/mariadb_lib.c:2104:3
    #4 0x5ceaa4f58c8b in mthd_my_send_cmd ./server/libmariadb/libmariadb/mariadb_lib.c:394:9
    #5 0x5ceaa4f5add5 in ma_simple_command ./server/libmariadb/libmariadb/mariadb_lib.c:472:10
    #6 0x5ceaa4f75044 in mysql_send_query ./server/libmariadb/libmariadb/mariadb_lib.c:2524:10
    #7 0x5ceaa4efc226 in wrap_mysql_send_query(st_mysql*, char const*, unsigned long) ./server/client/../tests/nonblock-wrappers.h:211:1
    #8 0x5ceaa4f2f8ce in run_query_normal(st_connection*, st_command*, int, char const*, unsigned long, st_dynamic_string*, st_dynamic_string*) ./server/client/mysqltest.cc:8230:9
    #9 0x5ceaa4f36676 in run_query(st_connection*, st_command*, int) ./server/client/mysqltest.cc:9652:5
    #10 0x5ceaa4f3a0ea in main ./server/client/mysqltest.cc:10484:2
    #11 0x7efaf322a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #12 0x7efaf322a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #13 0x5ceaa4e1fd44 in _start (./server/build116_asan/client/mariadb-test+0x141d44) (BuildId: 21b3097a37beada873a1eaa15c1ea1f16d3ad6d7)
  • Loading branch information
bnestere committed Nov 4, 2024
1 parent cfa87ef commit 7f434d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,10 @@ void free_used_memory()
DBUG_ENTER("free_used_memory");

if (connections)
{
close_connections();
cur_con= NULL;
}
close_files();
my_hash_free(&var_hash);

Expand Down

0 comments on commit 7f434d0

Please sign in to comment.