Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL), 10.4(EOL)
-
None
Description
Note: The test case is very non-deterministic, run with big --repeat (thousands). Usually it fails for me within 20-80 attempts, but sometimes on no apparent reasons it takes hundreds. It seems to be happening somewhat more readily on disk, as opposed to in memory, but it can be a false observation.
--source include/have_innodb.inc
|
|
--connect (con1,localhost,root,,test)
|
--connect (con2,localhost,root,,test)
|
|
CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT; |
INSERT INTO t1 (a) VALUES ('foo'); |
|
--connection con1
|
ALTER TABLE t1 ADD COLUMN b INT; |
|
--connection con2
|
--send
|
ALTER TABLE t1 ADD PRIMARY KEY (b); |
|
--connection con1
|
UPDATE t1 SET b = 1; |
|
--connection default
|
DROP TABLE t1; |
10.3 ASAN 5098d708 |
==6319==ERROR: AddressSanitizer: use-after-poison on address 0x7fd49f65c000 at pc 0x7fd4aa7a1f7f bp 0x7fd492d6b920 sp 0x7fd492d6b0d0
|
READ of size 4294967294 at 0x7fd49f65c000 thread T27
|
#0 0x7fd4aa7a1f7e (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
|
#1 0x55f3594bed20 in mem_heap_dup(mem_block_info_t*, void const*, unsigned long) /data/src/10.3/storage/innobase/include/mem0mem.h:242
|
#2 0x55f359788418 in row_log_table_get_pk_col /data/src/10.3/storage/innobase/row/row0log.cc:1204
|
#3 0x55f359789430 in row_log_table_get_pk(unsigned char const*, dict_index_t*, unsigned long const*, unsigned char*, mem_block_info_t**) /data/src/10.3/storage/innobase/row/row0log.cc:1341
|
#4 0x55f359826da9 in row_upd_clust_rec /data/src/10.3/storage/innobase/row/row0upd.cc:2861
|
#5 0x55f359828c79 in row_upd_clust_step /data/src/10.3/storage/innobase/row/row0upd.cc:3206
|
#6 0x55f359829716 in row_upd /data/src/10.3/storage/innobase/row/row0upd.cc:3307
|
#7 0x55f35982a503 in row_upd_step(que_thr_t*) /data/src/10.3/storage/innobase/row/row0upd.cc:3451
|
#8 0x55f3597659f3 in row_update_for_mysql(row_prebuilt_t*) /data/src/10.3/storage/innobase/row/row0mysql.cc:1888
|
#9 0x55f359484887 in ha_innobase::update_row(unsigned char const*, unsigned char const*) /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8849
|
#10 0x55f358f6eba2 in handler::ha_update_row(unsigned char const*, unsigned char const*) /data/src/10.3/sql/handler.cc:6478
|
#11 0x55f358abf7d1 in mysql_update(THD*, TABLE_LIST*, List<Item>&, List<Item>&, Item*, unsigned int, st_order*, unsigned long long, bool, unsigned long long*, unsigned long long*) /data/src/10.3/sql/sql_update.cc:954
|
#12 0x55f35885508c in mysql_execute_command(THD*) /data/src/10.3/sql/sql_parse.cc:4301
|
#13 0x55f35886c1f8 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.3/sql/sql_parse.cc:7815
|
#14 0x55f358846f1e in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.3/sql/sql_parse.cc:1856
|
#15 0x55f358843dfd in do_command(THD*) /data/src/10.3/sql/sql_parse.cc:1401
|
#16 0x55f358bb8d68 in do_handle_one_connection(CONNECT*) /data/src/10.3/sql/sql_connect.cc:1403
|
#17 0x55f358bb872f in handle_one_connection /data/src/10.3/sql/sql_connect.cc:1308
|
#18 0x55f35a01b625 in pfs_spawn_thread /data/src/10.3/storage/perfschema/pfs.cc:1862
|
#19 0x7fd4aa52f4a3 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x74a3)
|
#20 0x7fd4a8a76d0e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe8d0e)
|
|
AddressSanitizer can not describe address in more detail (wild memory access suspected).
|
SUMMARY: AddressSanitizer: use-after-poison (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x5cf7e)
|
Shadow bytes around the buggy address:
|
0x0ffb13ec37b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0ffb13ec37c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0ffb13ec37d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0ffb13ec37e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0ffb13ec37f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
=>0x0ffb13ec3800:[f7]f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
|
0x0ffb13ec3810: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
|
0x0ffb13ec3820: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
|
0x0ffb13ec3830: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
|
0x0ffb13ec3840: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
|
0x0ffb13ec3850: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
|
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
|
Thread T27 created by T0 here:
|
#0 0x7fd4aa775f59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
|
#1 0x55f35a01ba61 in spawn_thread_v1 /data/src/10.3/storage/perfschema/pfs.cc:1912
|
#2 0x55f3585b2be0 in inline_mysql_thread_create /data/src/10.3/include/mysql/psi/mysql_thread.h:1268
|
#3 0x55f3585c7eec in create_thread_to_handle_connection(CONNECT*) /data/src/10.3/sql/mysqld.cc:6600
|
#4 0x55f3585c85cf in create_new_thread /data/src/10.3/sql/mysqld.cc:6670
|
#5 0x55f3585c95e7 in handle_connections_sockets() /data/src/10.3/sql/mysqld.cc:6945
|
#6 0x55f3585c73bc in mysqld_main(int, char**) /data/src/10.3/sql/mysqld.cc:6222
|
#7 0x55f3585b12ff in main /data/src/10.3/sql/main.cc:25
|
#8 0x7fd4a89ae2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
|
|
==6319==ABORTING
|
Reproducible on 10.3-10.5.
Couldn't reproduce on 10.2.
I can repeat this, although not ver easily:
10.3 5098d708a07f90484c9e13fe3ab58113a8a10191
mysqltest: At line 14: query 'UPDATE t1 SET b = 1' failed: 2013: Lost connection to MySQL server during query
The result from queries just before the failure was:
connect con1,localhost,root,,test;
connect con2,localhost,root,,test;
CREATE TABLE t1 (a TEXT) ENGINE = InnoDB ROW_FORMAT=REDUNDANT;
INSERT INTO t1 (a) VALUES ('foo');
connection con1;
ALTER TABLE t1 ADD COLUMN b INT;
connection con2;
ALTER TABLE t1 ADD PRIMARY KEY (b);
connection con1;
UPDATE t1 SET b = 1;
Server [mysqld.1 - pid: 2326273, winpid: 2326273, exit: 256] failed during test run
Server log from this test:
----------SERVER LOG START-----------
=================================================================
==2326282==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f1b87740000 at pc 0x000000661b2a bp 0x7f1b7abaa730 sp 0x7f1b7aba9ef8
READ of size 4294967294 at 0x7f1b87740000 thread T27
#0 0x661b29 in __asan_memcpy (/dev/shm/10.3/sql/mysqld+0x661b29)
#1 0x1aa0c29 in mem_heap_dup(mem_block_info_t*, void const*, unsigned long) /mariadb/10.3/storage/innobase/include/mem0mem.h:242:5
#2 0x1aa0c29 in row_log_table_get_pk_col(dict_field_t const*, dfield_t*, mem_block_info_t*, unsigned char const*, unsigned long const*, unsigned long, page_size_t const&, unsigned long, row_log_t const*) /mariadb/10.3/storage/innobase/row/row0log.cc:1204:27
#3 0x1aa0c29 in row_log_table_get_pk(unsigned char const*, dict_index_t*, unsigned long const*, unsigned char*, mem_block_info_t**) /mariadb/10.3/storage/innobase/row/row0log.cc:1341:18
#4 0x1b850f6 in row_upd_clust_rec(unsigned long, upd_node_t*, dict_index_t*, unsigned long*, mem_block_info_t**, que_thr_t*, mtr_t*) /mariadb/10.3/storage/innobase/row/row0upd.cc:2860:20
#5 0x1b8163d in row_upd_clust_step(upd_node_t*, que_thr_t*) /mariadb/10.3/storage/innobase/row/row0upd.cc:3206:9
#6 0x1b79e95 in row_upd(upd_node_t*, que_thr_t*) /mariadb/10.3/storage/innobase/row/row0upd.cc:3307:9
#7 0x1b79e95 in row_upd_step(que_thr_t*) /mariadb/10.3/storage/innobase/row/row0upd.cc:3451:8
#8 0x1a7e1b7 in row_update_for_mysql(row_prebuilt_t*) /mariadb/10.3/storage/innobase/row/row0mysql.cc:1888:3
#9 0x171d7f5 in ha_innobase::update_row(unsigned char const*, unsigned char const*) /mariadb/10.3/storage/innobase/handler/ha_innodb.cc:8849:11
#10 0x10d5f68 in handler::ha_update_row(unsigned char const*, unsigned char const*) /mariadb/10.3/sql/handler.cc:6478:3
#11 0xc1d89c in mysql_update(THD*, TABLE_LIST*, List<Item>&, List<Item>&, Item*, unsigned int, st_order*, unsigned long long, bool, unsigned long long*, unsigned long long*) /mariadb/10.3/sql/sql_update.cc:954:31
#12 0x987ec2 in mysql_execute_command(THD*) /mariadb/10.3/sql/sql_parse.cc:4294:21
#13 0x973f8f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /mariadb/10.3/sql/sql_parse.cc:7815:18
#14 0x966b2d in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /mariadb/10.3/sql/sql_parse.cc:1855:7
#15 0x96e4e7 in do_command(THD*) /mariadb/10.3/sql/sql_parse.cc:1401:17
#16 0xd18973 in do_handle_one_connection(CONNECT*) /mariadb/10.3/sql/sql_connect.cc:1403:11
#17 0xd181b3 in handle_one_connection /mariadb/10.3/sql/sql_connect.cc:1308:3
#18 0x2472d35 in pfs_spawn_thread /mariadb/10.3/storage/perfschema/pfs.cc:1862:3
#19 0x7f1b91ec0fb6 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x8fb6)
#20 0x7f1b913252ce in clone (/lib/x86_64-linux-gnu/libc.so.6+0xfa2ce)
0x7f1b87740000 is located 6144 bytes to the left of 406136-byte region [0x7f1b87741800,0x7f1b877a4a78)
allocated by thread T0 here:
#0 0x6626ed in malloc (/dev/shm/10.3/sql/mysqld+0x6626ed)
#1 0x1fdfe5c in hash0_create(unsigned long) /mariadb/10.3/storage/innobase/ha/hash0hash.cc:110:3
…
#5 0x00000000006801a7 in __sanitizer::Abort() ()
#6 0x000000000067eb81 in __sanitizer::Die() ()
#7 0x0000000000666709 in __asan::ScopedInErrorReport::~ScopedInErrorReport() ()
#8 0x0000000000667e7f in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) ()
#9 0x0000000000661b49 in __asan_memcpy ()
#10 0x0000000001aa0c2a in mem_heap_dup (heap=<optimized out>, data=0x7f1b8745409d, len=4294967294) at /mariadb/10.3/storage/innobase/include/mem0mem.h:242
#11 row_log_table_get_pk_col (ifield=<optimized out>, dfield=<optimized out>, heap=0x612000084c40, rec=0x7f1b87454087 "", offsets=<optimized out>, i=<optimized out>, page_size=..., log=<optimized out>, max_len=<optimized out>) at /mariadb/10.3/storage/innobase/row/row0log.cc:1204
#12 row_log_table_get_pk (rec=<optimized out>, index=<optimized out>, offsets=<optimized out>, sys=<optimized out>, heap=<optimized out>) at /mariadb/10.3/storage/innobase/row/row0log.cc:1341
#13 0x0000000001b850f7 in row_upd_clust_rec (flags=<optimized out>, node=<optimized out>, index=<optimized out>, offsets=0x0, offsets_heap=<optimized out>, thr=<optimized out>, mtr=<optimized out>) at /mariadb/10.3/storage/innobase/row/row0upd.cc:2860
#14 0x0000000001b8163e in row_upd_clust_step (node=<optimized out>, thr=<optimized out>) at /mariadb/10.3/storage/innobase/row/row0upd.cc:3206
#15 0x0000000001b79e96 in row_upd (node=<optimized out>, thr=0x620000012c28) at /mariadb/10.3/storage/innobase/row/row0upd.cc:3307
#16 row_upd_step (thr=<optimized out>) at /mariadb/10.3/storage/innobase/row/row0upd.cc:3451
#17 0x0000000001a7e1b8 in row_update_for_mysql (prebuilt=0x620000012110) at /mariadb/10.3/storage/innobase/row/row0mysql.cc:1888
#18 0x000000000171d7f6 in ha_innobase::update_row (this=0x61c0000730a8, old_row=<optimized out>, new_row=<optimized out>) at /mariadb/10.3/storage/innobase/handler/ha_innodb.cc:8849
#19 0x00000000010d5f69 in handler::ha_update_row (this=0x61c0000730a8, old_data=<optimized out>, new_data=<optimized out>) at /mariadb/10.3/sql/handler.cc:6478
#20 0x0000000000c1d89d in mysql_update (thd=<optimized out>, table_list=<optimized out>, fields=..., values=..., conds=<optimized out>, order_num=<optimized out>, order=0x62b000000fe0, limit=18446744073709551615, ignore=<optimized out>, found_return=<optimized out>, updated_return=<optimized out>) at /mariadb/10.3/sql/sql_update.cc:954
#21 0x0000000000987ec3 in mysql_execute_command (thd=0x62a0000ba208) at /mariadb/10.3/sql/sql_parse.cc:4294
I cannot immediately recognize any wrongdoing. row_upd_clust_rec() should be passing a pointer to NULL, and row_log_table_get_pk() should have assigned *heap = mem_heap_create(…);. I do not see any call to mem_heap_free() in between.
kevg, could we have some bug in our use of ASAN_POISON_MEMORY_REGION or MEM_NOACCESS or TRASH_FREE or UNIV_MEM_FREE?