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

ER_NOT_KEYFILE (Index for table is corrupt; try to repair it) or ASAN errors upon concurrent DELETE and LOCK

    XMLWordPrintable

    Details

      Description

      Note: The test case is non-deterministic, run with --repeat=N. Currently it fails for me on within a few attempts on a debug build, but it can vary on different machines and builds. Couldn't get it on a release build even within 2000 attempts (not sure whether it is due to a different timing or a different logic).

      CREATE TABLE table_1 ( f1 VARCHAR(32) CHARACTER SET utf8 NOT NULL, KEY (f1) USING HASH) ENGINE=HEAP;
      INSERT INTO table_1 VALUES (''),(''),(''),(''),(''),(''),(''),('');
      INSERT INTO table_1 SELECT * FROM table_1;
      INSERT INTO table_1 SELECT * FROM table_1;
      INSERT INTO table_1 SELECT * FROM table_1;
      SET lock_wait_timeout= 1;
       
      LOCK TABLES table_1 WRITE CONCURRENT;
       
      --connect (con1,localhost,root,,test)
      SET lock_wait_timeout= 1;
      --send
        DELETE FROM table_1 WHERE f1 < 'bar';
       
      --connection default
      --error 0,ER_LOCK_WAIT_TIMEOUT
      LOCK TABLE table_1 READ NOWAIT;
       
      # Cleanup
      --connection con1
      --error 0,ER_LOCK_WAIT_TIMEOUT
      --reap
      --disconnect con1
      --connection default
      UNLOCK TABLES;
      DROP TABLE table_1;
      

      10.3 59a08874 debug

      LOCK TABLE table_1 READ NOWAIT;
      bug.5348a                                [ fail ]
              Test ended at 2019-12-20 20:55:24
       
      CURRENT_TEST: bug.5348a
      mysqltest: At line 17: query 'LOCK TABLE table_1 READ NOWAIT' failed with wrong errno 1034: 'Index for table 'table_1' is corrupt; try to repair it', instead of 0...
      

      Reproducible on 10.3-10.5.
      The test case is not applicable to earlier versions due to the use of NOWAIT, and I couldn't get rid of it. It's possible however that the underlying cause exists in other versions as well.

      In a similar test case, which also produces ER_NOT_KEYFILE, if we take it a little further and allow the error, various ASAN errors happen on an ASAN build.
      The test case is to be run with --repeat=N --nowarnings.

      CREATE TABLE t1 ( f1 VARCHAR(32), f2 VARCHAR(128), KEY(f2) USING BTREE ) ENGINE=HEAP;
      INSERT IGNORE INTO t1 VALUES ('',''),('', 'g'),('l', ''),( 'p', 'x' ),('','');
      INSERT INTO t1 SELECT * FROM t1;
      INSERT INTO t1 SELECT * FROM t1;
      INSERT INTO t1 SELECT * FROM t1;
      INSERT INTO t1 SELECT * FROM t1;
      LOCK TABLES t1 n WRITE CONCURRENT WAIT 1;
       
      --connect (con1,localhost,root,,test)
      --send
      DELETE FROM t1 WHERE f1 < 'bar';
      --connection default
      --error 0,ER_NOT_KEYFILE,ER_LOCK_WAIT_TIMEOUT
      LOCK TABLE t1 READ NOWAIT;
       
      # Cleanup
      --connection con1
      --reap
      --disconnect con1
      --connection default
      UNLOCK TABLES;
      DROP TABLE t1;
      

      10.3 ASAN 59a08874

      ==24464==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e000398998 at pc 0x55c2c257f884 bp 0x7f3f0053dbb0 sp 0x7f3f0053dba8
      READ of size 8 at 0x60e000398998 thread T6
          #0 0x55c2c257f883 in tree_search_next /data/src/10.3/mysys/tree.c:512
          #1 0x55c2c188ae49 in check_one_rb_key /data/src/10.3/storage/heap/_check.c:193
          #2 0x55c2c188a04e in heap_check_heap /data/src/10.3/storage/heap/_check.c:53
          #3 0x55c2c1872c60 in ha_heap::external_lock(THD*, int) /data/src/10.3/storage/heap/ha_heap.cc:434
          #4 0x55c2c13a749a in handler::ha_external_lock(THD*, int) /data/src/10.3/sql/handler.cc:6371
          #5 0x55c2c1666c77 in unlock_external /data/src/10.3/sql/lock.cc:708
          #6 0x55c2c1663c06 in mysql_lock_tables(THD*, st_mysql_lock*, unsigned int) /data/src/10.3/sql/lock.cc:352
          #7 0x55c2c16636bd in mysql_lock_tables(THD*, TABLE**, unsigned int, unsigned int) /data/src/10.3/sql/lock.cc:299
          #8 0x55c2c0b40b7b in lock_tables(THD*, TABLE_LIST*, unsigned int, unsigned int) /data/src/10.3/sql/sql_base.cc:5296
          #9 0x55c2c0c84f6c in lock_tables_open_and_lock_tables /data/src/10.3/sql/sql_parse.cc:2927
          #10 0x55c2c0c91b43 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4950
          #11 0x55c2c0ca45d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #12 0x55c2c0c7f2c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #13 0x55c2c0c7c1a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #14 0x55c2c0ff209e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #15 0x55c2c0ff1a65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #16 0x55c2c245a32d in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
          #17 0x7f3f0c5a34a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
          #18 0x7f3f0a6d7d0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
       
      0x60e000398998 is located 120 bytes inside of 156-byte region [0x60e000398920,0x60e0003989bc)
      freed by thread T5 here:
          #0 0x7f3f0c87aa10 in free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10)
          #1 0x55c2c258afd4 in free_memory /data/src/10.3/mysys/safemalloc.c:279
          #2 0x55c2c258a6bd in sf_free /data/src/10.3/mysys/safemalloc.c:197
          #3 0x55c2c255c84f in my_free /data/src/10.3/mysys/my_malloc.c:223
          #4 0x55c2c257eb1d in tree_delete /data/src/10.3/mysys/tree.c:372
          #5 0x55c2c1876ae9 in hp_rb_delete_key /data/src/10.3/storage/heap/hp_delete.c:81
          #6 0x55c2c1876568 in heap_delete /data/src/10.3/storage/heap/hp_delete.c:41
          #7 0x55c2c1871544 in ha_heap::delete_row(unsigned char const*) /data/src/10.3/storage/heap/ha_heap.cc:273
          #8 0x55c2c13a9dab in handler::ha_delete_row(unsigned char const*) /data/src/10.3/sql/handler.cc:6534
          #9 0x55c2c179ff4d in TABLE::delete_row() /data/src/10.3/sql/sql_delete.cc:245
          #10 0x55c2c1798a43 in mysql_delete(THD*, TABLE_LIST*, Item*, SQL_I_List<st_order>*, unsigned long long, unsigned long long, select_result*) /data/src/10.3/sql/sql_delete.cc:720
          #11 0x55c2c0c8fbaa in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4658
          #12 0x55c2c0ca45d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #13 0x55c2c0c7f2c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #14 0x55c2c0c7c1a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #15 0x55c2c0ff209e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #16 0x55c2c0ff1a65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #17 0x55c2c245a32d in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
          #18 0x7f3f0c5a34a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      previously allocated by thread T6 here:
          #0 0x7f3f0c87ad28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
          #1 0x55c2c258a0d5 in sf_malloc /data/src/10.3/mysys/safemalloc.c:118
          #2 0x55c2c255bf5e in my_malloc /data/src/10.3/mysys/my_malloc.c:101
          #3 0x55c2c257dd83 in tree_insert /data/src/10.3/mysys/tree.c:278
          #4 0x55c2c1888253 in hp_rb_write_key /data/src/10.3/storage/heap/hp_write.c:121
          #5 0x55c2c18877f8 in heap_write /data/src/10.3/storage/heap/hp_write.c:52
          #6 0x55c2c18710ec in ha_heap::write_row(unsigned char*) /data/src/10.3/storage/heap/ha_heap.cc:239
          #7 0x55c2c13a86a7 in handler::ha_write_row(unsigned char*) /data/src/10.3/sql/handler.cc:6446
          #8 0x55c2c0bf9e21 in write_record(THD*, TABLE*, st_copy_info*) /data/src/10.3/sql/sql_insert.cc:2034
          #9 0x55c2c0c08b4e in select_insert::send_data(List<Item>&) /data/src/10.3/sql/sql_insert.cc:3952
          #10 0x55c2c0dad645 in end_send /data/src/10.3/sql/sql_select.cc:20758
          #11 0x55c2c0da5bc2 in evaluate_join_record /data/src/10.3/sql/sql_select.cc:19798
          #12 0x55c2c0dde8ff in AGGR_OP::end_send() /data/src/10.3/sql/sql_select.cc:27681
          #13 0x55c2c0da3910 in sub_select_postjoin_aggr(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:19294
          #14 0x55c2c0da40e5 in sub_select(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:19529
          #15 0x55c2c0da2be8 in do_select /data/src/10.3/sql/sql_select.cc:19120
          #16 0x55c2c0d3e6ba in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:4092
          #17 0x55c2c0d3c2ed in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3886
          #18 0x55c2c0d3f7cc in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.3/sql/sql_select.cc:4291
          #19 0x55c2c0d1985b in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.3/sql/sql_select.cc:370
          #20 0x55c2c0c8f035 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4571
          #21 0x55c2c0ca45d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #22 0x55c2c0c7f2c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #23 0x55c2c0c7c1a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #24 0x55c2c0ff209e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #25 0x55c2c0ff1a65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #26 0x55c2c245a32d in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
          #27 0x7f3f0c5a34a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      Thread T6 created by T0 here:
          #0 0x7f3f0c7e9f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x55c2c245a769 in spawn_thread_v1 /data/src/10.3/storage/perfschema/pfs.cc:1912
          #2 0x55c2c09e8f90 in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
          #3 0x55c2c09fe29c in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6600
          #4 0x55c2c09fe97f in create_new_thread /data/src/10.3/sql/mysqld.cc:6670
          #5 0x55c2c09ff997 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6945
          #6 0x55c2c09fd76c in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6222
          #7 0x55c2c09e76af in main /data/src/10.3/sql/main.cc:25
          #8 0x7f3f0a60f2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      Thread T5 created by T0 here:
          #0 0x7f3f0c7e9f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x55c2c245a769 in spawn_thread_v1 /data/src/10.3/storage/perfschema/pfs.cc:1912
          #2 0x55c2c09e8f90 in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
          #3 0x55c2c09fe29c in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6600
          #4 0x55c2c09fe97f in create_new_thread /data/src/10.3/sql/mysqld.cc:6670
          #5 0x55c2c09ff997 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6945
          #6 0x55c2c09fd76c in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6222
          #7 0x55c2c09e76af in main /data/src/10.3/sql/main.cc:25
          #8 0x7f3f0a60f2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.3/mysys/tree.c:512 in tree_search_next
      Shadow bytes around the buggy address:
        0x0c1c8006b0e0: 00 00 00 04 fa fa fa fa fa fa fa fa fd fd fd fd
        0x0c1c8006b0f0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c1c8006b100: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
        0x0c1c8006b110: fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa
        0x0c1c8006b120: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
      =>0x0c1c8006b130: fd fd fd[fd]fd fd fd fd fa fa fa fa fa fa fa fa
        0x0c1c8006b140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c1c8006b150: 00 00 00 04 fa fa fa fa fa fa fa fa 00 00 00 00
        0x0c1c8006b160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04
        0x0c1c8006b170: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
        0x0c1c8006b180: fd fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07 
        Heap left redzone:       fa
        Heap right redzone:      fb
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        Stack partial redzone:   f4
        Stack after return:      f5
        Stack use after scope:   f8
        Global redzone:          f9
        Global init order:       f6
        Poisoned by user:        f7
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      ==24464==ABORTING
      

      or

      ==15642==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e000086b08 at pc 0x55c677474515 bp 0x7feec95d3c70 sp 0x7feec95d3c68
      READ of size 1 at 0x60e000086b08 thread T27
          #0 0x55c677474514 in hp_rb_var_key_length /data/src/10.3/storage/heap/hp_hash.c:801
          #1 0x55c67747fc71 in check_one_rb_key /data/src/10.3/storage/heap/_check.c:182
          #2 0x55c67747f04e in heap_check_heap /data/src/10.3/storage/heap/_check.c:53
          #3 0x55c677467c60 in ha_heap::external_lock(THD*, int) /data/src/10.3/storage/heap/ha_heap.cc:434
          #4 0x55c676f9c587 in handler::ha_external_lock(THD*, int) /data/src/10.3/sql/handler.cc:6371
          #5 0x55c67725bc77 in unlock_external /data/src/10.3/sql/lock.cc:708
          #6 0x55c677258c06 in mysql_lock_tables(THD*, st_mysql_lock*, unsigned int) /data/src/10.3/sql/lock.cc:352
          #7 0x55c6772586bd in mysql_lock_tables(THD*, TABLE**, unsigned int, unsigned int) /data/src/10.3/sql/lock.cc:299
          #8 0x55c676735b7b in lock_tables(THD*, TABLE_LIST*, unsigned int, unsigned int) /data/src/10.3/sql/sql_base.cc:5296
          #9 0x55c676879f6c in lock_tables_open_and_lock_tables /data/src/10.3/sql/sql_parse.cc:2927
          #10 0x55c676886b43 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4950
          #11 0x55c6768995d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #12 0x55c6768742c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #13 0x55c6768711a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #14 0x55c676be709e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #15 0x55c676be6a65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #16 0x7feeed51c4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
          #17 0x7feeeb650d0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
       
      0x60e000086b08 is located 136 bytes inside of 156-byte region [0x60e000086a80,0x60e000086b1c)
      freed by thread T28 here:
          #0 0x7feeed7f3a10 in free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10)
          #1 0x55c67817ffd4 in free_memory /data/src/10.3/mysys/safemalloc.c:279
          #2 0x55c67817f6bd in sf_free /data/src/10.3/mysys/safemalloc.c:197
          #3 0x55c67815184f in my_free /data/src/10.3/mysys/my_malloc.c:223
          #4 0x55c678173b1d in tree_delete /data/src/10.3/mysys/tree.c:372
          #5 0x55c67746bae9 in hp_rb_delete_key /data/src/10.3/storage/heap/hp_delete.c:81
          #6 0x55c67746b568 in heap_delete /data/src/10.3/storage/heap/hp_delete.c:41
          #7 0x55c677466544 in ha_heap::delete_row(unsigned char const*) /data/src/10.3/storage/heap/ha_heap.cc:273
          #8 0x55c676f9ee93 in handler::ha_delete_row(unsigned char const*) /data/src/10.3/sql/handler.cc:6534
          #9 0x55c677394f4d in TABLE::delete_row() /data/src/10.3/sql/sql_delete.cc:245
          #10 0x55c67738da43 in mysql_delete(THD*, TABLE_LIST*, Item*, SQL_I_List<st_order>*, unsigned long long, unsigned long long, select_result*) /data/src/10.3/sql/sql_delete.cc:720
          #11 0x55c676884baa in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4658
          #12 0x55c6768995d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #13 0x55c6768742c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #14 0x55c6768711a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #15 0x55c676be709e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #16 0x55c676be6a65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #17 0x7feeed51c4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      previously allocated by thread T27 here:
          #0 0x7feeed7f3d28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
          #1 0x55c67817f0d5 in sf_malloc /data/src/10.3/mysys/safemalloc.c:118
          #2 0x55c678150f5e in my_malloc /data/src/10.3/mysys/my_malloc.c:101
          #3 0x55c678172d83 in tree_insert /data/src/10.3/mysys/tree.c:278
          #4 0x55c67747d253 in hp_rb_write_key /data/src/10.3/storage/heap/hp_write.c:121
          #5 0x55c67747c7f8 in heap_write /data/src/10.3/storage/heap/hp_write.c:52
          #6 0x55c6774660ec in ha_heap::write_row(unsigned char*) /data/src/10.3/storage/heap/ha_heap.cc:239
          #7 0x55c676f9d791 in handler::ha_write_row(unsigned char*) /data/src/10.3/sql/handler.cc:6446
          #8 0x55c6767eee21 in write_record(THD*, TABLE*, st_copy_info*) /data/src/10.3/sql/sql_insert.cc:2034
          #9 0x55c6767e7bc7 in mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) /data/src/10.3/sql/sql_insert.cc:1072
          #10 0x55c676883098 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4455
          #11 0x55c6768995d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #12 0x55c6768742c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #13 0x55c6768711a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #14 0x55c676be709e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #15 0x55c676be6a65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #16 0x7feeed51c4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      Thread T27 created by T0 here:
          #0 0x7feeed762f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x55c6781a932f in spawn_thread_noop /data/src/10.3/mysys/psi_noop.c:187
          #2 0x55c6765ddf90 in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
          #3 0x55c6765f329c in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6600
          #4 0x55c6765f397f in create_new_thread /data/src/10.3/sql/mysqld.cc:6670
          #5 0x55c6765f4997 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6945
          #6 0x55c6765f276c in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6222
          #7 0x55c6765dc6af in main /data/src/10.3/sql/main.cc:25
          #8 0x7feeeb5882e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      Thread T28 created by T0 here:
          #0 0x7feeed762f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x55c6781a932f in spawn_thread_noop /data/src/10.3/mysys/psi_noop.c:187
          #2 0x55c6765ddf90 in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
          #3 0x55c6765f329c in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6600
          #4 0x55c6765f397f in create_new_thread /data/src/10.3/sql/mysqld.cc:6670
          #5 0x55c6765f4997 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6945
          #6 0x55c6765f276c in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6222
          #7 0x55c6765dc6af in main /data/src/10.3/sql/main.cc:25
          #8 0x7feeeb5882e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.3/storage/heap/hp_hash.c:801 in hp_rb_var_key_length
      Shadow bytes around the buggy address:
        0x0c1c80008d10: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
        0x0c1c80008d20: 00 00 00 00 00 00 00 00 00 00 00 04 fa fa fa fa
        0x0c1c80008d30: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c1c80008d40: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
        0x0c1c80008d50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
      =>0x0c1c80008d60: fd[fd]fd fd fa fa fa fa fa fa fa fa fd fd fd fd
        0x0c1c80008d70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa
        0x0c1c80008d80: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
        0x0c1c80008d90: fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa
        0x0c1c80008da0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c1c80008db0: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa fa
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07 
        Heap left redzone:       fa
        Heap right redzone:      fb
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        Stack partial redzone:   f4
        Stack after return:      f5
        Stack use after scope:   f8
        Global redzone:          f9
        Global init order:       f6
        Poisoned by user:        f7
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      ==15642==ABORTING
      ----------SERVER LOG END-------------
      

      or

      ==30890==ERROR: AddressSanitizer: heap-use-after-free on address 0x60e000092808 at pc 0x561ffd84db1a bp 0x7f73fc20cac0 sp 0x7f73fc20cab8
      READ of size 1 at 0x60e000092808 thread T29
          #0 0x561ffd84db19 in ha_key_cmp /data/src/10.3/mysys/my_compare.c:241
          #1 0x561ffcb83dd5 in check_one_rb_key /data/src/10.3/storage/heap/_check.c:184
          #2 0x561ffcb8304e in heap_check_heap /data/src/10.3/storage/heap/_check.c:53
          #3 0x561ffcb6bc60 in ha_heap::external_lock(THD*, int) /data/src/10.3/storage/heap/ha_heap.cc:434
          #4 0x561ffc6a0587 in handler::ha_external_lock(THD*, int) /data/src/10.3/sql/handler.cc:6371
          #5 0x561ffc95fc77 in unlock_external /data/src/10.3/sql/lock.cc:708
          #6 0x561ffc95cc06 in mysql_lock_tables(THD*, st_mysql_lock*, unsigned int) /data/src/10.3/sql/lock.cc:352
          #7 0x561ffc95c6bd in mysql_lock_tables(THD*, TABLE**, unsigned int, unsigned int) /data/src/10.3/sql/lock.cc:299
          #8 0x561ffbe39b7b in lock_tables(THD*, TABLE_LIST*, unsigned int, unsigned int) /data/src/10.3/sql/sql_base.cc:5296
          #9 0x561ffbf7df6c in lock_tables_open_and_lock_tables /data/src/10.3/sql/sql_parse.cc:2927
          #10 0x561ffbf8ab43 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4950
          #11 0x561ffbf9d5d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #12 0x561ffbf782c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #13 0x561ffbf751a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #14 0x561ffc2eb09e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #15 0x561ffc2eaa65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #16 0x7f74203ef4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
          #17 0x7f741e523d0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
       
      0x60e000092808 is located 136 bytes inside of 156-byte region [0x60e000092780,0x60e00009281c)
      freed by thread T28 here:
          #0 0x7f74206c6a10 in free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10)
          #1 0x561ffd883fd4 in free_memory /data/src/10.3/mysys/safemalloc.c:279
          #2 0x561ffd8836bd in sf_free /data/src/10.3/mysys/safemalloc.c:197
          #3 0x561ffd85584f in my_free /data/src/10.3/mysys/my_malloc.c:223
          #4 0x561ffd877b1d in tree_delete /data/src/10.3/mysys/tree.c:372
          #5 0x561ffcb6fae9 in hp_rb_delete_key /data/src/10.3/storage/heap/hp_delete.c:81
          #6 0x561ffcb6f568 in heap_delete /data/src/10.3/storage/heap/hp_delete.c:41
          #7 0x561ffcb6a544 in ha_heap::delete_row(unsigned char const*) /data/src/10.3/storage/heap/ha_heap.cc:273
          #8 0x561ffc6a2e93 in handler::ha_delete_row(unsigned char const*) /data/src/10.3/sql/handler.cc:6534
          #9 0x561ffca98f4d in TABLE::delete_row() /data/src/10.3/sql/sql_delete.cc:245
          #10 0x561ffca91a43 in mysql_delete(THD*, TABLE_LIST*, Item*, SQL_I_List<st_order>*, unsigned long long, unsigned long long, select_result*) /data/src/10.3/sql/sql_delete.cc:720
          #11 0x561ffbf88baa in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4658
          #12 0x561ffbf9d5d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #13 0x561ffbf782c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #14 0x561ffbf751a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #15 0x561ffc2eb09e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #16 0x561ffc2eaa65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #17 0x7f74203ef4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      previously allocated by thread T29 here:
          #0 0x7f74206c6d28 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1d28)
          #1 0x561ffd8830d5 in sf_malloc /data/src/10.3/mysys/safemalloc.c:118
          #2 0x561ffd854f5e in my_malloc /data/src/10.3/mysys/my_malloc.c:101
          #3 0x561ffd876d83 in tree_insert /data/src/10.3/mysys/tree.c:278
          #4 0x561ffcb81253 in hp_rb_write_key /data/src/10.3/storage/heap/hp_write.c:121
          #5 0x561ffcb807f8 in heap_write /data/src/10.3/storage/heap/hp_write.c:52
          #6 0x561ffcb6a0ec in ha_heap::write_row(unsigned char*) /data/src/10.3/storage/heap/ha_heap.cc:239
          #7 0x561ffc6a1791 in handler::ha_write_row(unsigned char*) /data/src/10.3/sql/handler.cc:6446
          #8 0x561ffbef2e21 in write_record(THD*, TABLE*, st_copy_info*) /data/src/10.3/sql/sql_insert.cc:2034
          #9 0x561ffbf01b4e in select_insert::send_data(List<Item>&) /data/src/10.3/sql/sql_insert.cc:3952
          #10 0x561ffc0a6645 in end_send /data/src/10.3/sql/sql_select.cc:20758
          #11 0x561ffc09ebc2 in evaluate_join_record /data/src/10.3/sql/sql_select.cc:19798
          #12 0x561ffc09de17 in sub_select(JOIN*, st_join_table*, bool) /data/src/10.3/sql/sql_select.cc:19617
          #13 0x561ffc09bae6 in do_select /data/src/10.3/sql/sql_select.cc:19118
          #14 0x561ffc0376ba in JOIN::exec_inner() /data/src/10.3/sql/sql_select.cc:4092
          #15 0x561ffc0352ed in JOIN::exec() /data/src/10.3/sql/sql_select.cc:3886
          #16 0x561ffc0387cc in mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) /data/src/10.3/sql/sql_select.cc:4291
          #17 0x561ffc01285b in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.3/sql/sql_select.cc:370
          #18 0x561ffbf88035 in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4571
          #19 0x561ffbf9d5d6 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7818
          #20 0x561ffbf782c2 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
          #21 0x561ffbf751a1 in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
          #22 0x561ffc2eb09e in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
          #23 0x561ffc2eaa65 in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
          #24 0x7f74203ef4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
       
      Thread T29 created by T0 here:
          #0 0x7f7420635f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x561ffd8ad32f in spawn_thread_noop /data/src/10.3/mysys/psi_noop.c:187
          #2 0x561ffbce1f90 in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
          #3 0x561ffbcf729c in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6600
          #4 0x561ffbcf797f in create_new_thread /data/src/10.3/sql/mysqld.cc:6670
          #5 0x561ffbcf8997 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6945
          #6 0x561ffbcf676c in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6222
          #7 0x561ffbce06af in main /data/src/10.3/sql/main.cc:25
          #8 0x7f741e45b2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      Thread T28 created by T0 here:
          #0 0x7f7420635f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
          #1 0x561ffd8ad32f in spawn_thread_noop /data/src/10.3/mysys/psi_noop.c:187
          #2 0x561ffbce1f90 in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
          #3 0x561ffbcf729c in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6600
          #4 0x561ffbcf797f in create_new_thread /data/src/10.3/sql/mysqld.cc:6670
          #5 0x561ffbcf8997 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6945
          #6 0x561ffbcf676c in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6222
          #7 0x561ffbce06af in main /data/src/10.3/sql/main.cc:25
          #8 0x7f741e45b2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
       
      SUMMARY: AddressSanitizer: heap-use-after-free /data/src/10.3/mysys/my_compare.c:241 in ha_key_cmp
      Shadow bytes around the buggy address:
        0x0c1c8000a4b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c8000a4c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
        0x0c1c8000a4d0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
        0x0c1c8000a4e0: 00 00 00 00 00 00 00 04 fa fa fa fa fa fa fa fa
        0x0c1c8000a4f0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
      =>0x0c1c8000a500: fd[fd]fd fd fa fa fa fa fa fa fa fa fd fd fd fd
        0x0c1c8000a510: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c1c8000a520: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
        0x0c1c8000a530: 00 00 00 00 00 00 00 00 00 00 04 fa fa fa fa fa
        0x0c1c8000a540: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
        0x0c1c8000a550: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
      Shadow byte legend (one shadow byte represents 8 application bytes):
        Addressable:           00
        Partially addressable: 01 02 03 04 05 06 07 
        Heap left redzone:       fa
        Heap right redzone:      fb
        Freed heap region:       fd
        Stack left redzone:      f1
        Stack mid redzone:       f2
        Stack right redzone:     f3
        Stack partial redzone:   f4
        Stack after return:      f5
        Stack use after scope:   f8
        Global redzone:          f9
        Global init order:       f6
        Poisoned by user:        f7
        Container overflow:      fc
        Array cookie:            ac
        Intra object redzone:    bb
        ASan internal:           fe
        Left alloca redzone:     ca
        Right alloca redzone:    cb
      ==30890==ABORTING
      

        Attachments

          Activity

            People

            Assignee:
            svoj Sergey Vojtovich
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: