Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL), 10.4(EOL)
Description
Test case 1 |
CREATE TABLE t1 (id INT, a CHAR(3), PRIMARY KEY(id), KEY(id,a), KEY(a,id)); |
INSERT INTO t1 VALUES (1,'ITA'), (2,'FRA'); |
|
CREATE TABLE t2 (id INT, b CHAR(3), PRIMARY KEY(id)); |
INSERT INTO t2 VALUES (1,'IT'),(2,'FR'); |
|
CREATE TABLE t3 (id INT, UNIQUE(id)); |
INSERT INTO t3 VALUES (1),(2); |
|
SELECT * FROM t1 LEFT JOIN (t2 INNER JOIN t3 ON (t3.id = t2.id)) ON (t1.a = t2.b) WHERE t1.a NOT IN ('GER', 'USA'); |
10.4 41a961d8 ASAN build |
==1529440==ERROR: AddressSanitizer: use-after-poison on address 0x6190000932b8 at pc 0x564530a91a2d bp 0x7f5f15961590 sp 0x7f5f15961580
|
READ of size 4 at 0x6190000932b8 thread T5
|
#0 0x564530a91a2c in Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM*, Field*, Item*) /data/src/10.4/sql/opt_range.cc:7806
|
#1 0x564530a94a2b in Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM*, Item_field*, Item*) /data/src/10.4/sql/opt_range.cc:8245
|
#2 0x564530a96e90 in Item_func_in::get_mm_tree(RANGE_OPT_PARAM*, Item**) /data/src/10.4/sql/opt_range.cc:8484
|
#3 0x564530a94ffd in Item_cond_and::get_mm_tree(RANGE_OPT_PARAM*, Item**) /data/src/10.4/sql/opt_range.cc:8299
|
#4 0x564530a710ad in SQL_SELECT::test_quick_select(THD*, Bitmap<64u>, unsigned long long, unsigned long long, bool, bool, bool, bool) /data/src/10.4/sql/opt_range.cc:2852
|
#5 0x56452ffb61a8 in make_join_select /data/src/10.4/sql/sql_select.cc:11661
|
#6 0x56452ff6b8df in JOIN::optimize_stage2() /data/src/10.4/sql/sql_select.cc:2548
|
#7 0x56452ff68b03 in JOIN::optimize_inner() /data/src/10.4/sql/sql_select.cc:2298
|
#8 0x56452ff617d7 in JOIN::optimize() /data/src/10.4/sql/sql_select.cc:1619
|
#9 0x56452ff82349 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.4/sql/sql_select.cc:4685
|
#10 0x56452ff53af1 in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.4/sql/sql_select.cc:410
|
#11 0x56452fec366d in execute_sqlcom_select /data/src/10.4/sql/sql_parse.cc:6398
|
#12 0x56452feb0ec5 in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:3925
|
#13 0x56452feccabe in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:7936
|
#14 0x56452fea37ab in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1839
|
#15 0x56452fea025a in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1357
|
#16 0x564530291855 in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1412
|
#17 0x5645302910f9 in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1316
|
#18 0x5645319473be in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1869
|
#19 0x7f5f1f99a608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477
|
#20 0x7f5f1f203292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
|
|
0x6190000932b8 is located 1080 bytes inside of 1100-byte region [0x619000092e80,0x6190000932cc)
|
allocated by thread T5 here:
|
#0 0x7f5f1fb90bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
|
#1 0x564531a95aa8 in sf_malloc /data/src/10.4/mysys/safemalloc.c:118
|
#2 0x564531a638e8 in my_malloc /data/src/10.4/mysys/my_malloc.c:101
|
#3 0x564531a3f396 in alloc_root /data/src/10.4/mysys/my_alloc.c:251
|
#4 0x564531a40b58 in strmake_root /data/src/10.4/mysys/my_alloc.c:481
|
#5 0x5645301bf87c in open_table_from_share(THD*, TABLE_SHARE*, st_mysql_const_lex_string const*, unsigned int, unsigned int, unsigned int, TABLE*, bool, List<String>*) /data/src/10.4/sql/table.cc:3651
|
#6 0x56452fd1c7ef in open_table(THD*, TABLE_LIST*, Open_table_context*) /data/src/10.4/sql/sql_base.cc:2095
|
#7 0x56452fd26269 in open_and_process_table /data/src/10.4/sql/sql_base.cc:3905
|
#8 0x56452fd28dbd in open_tables(THD*, DDL_options_st const&, TABLE_LIST**, unsigned int*, unsigned int, Prelocking_strategy*) /data/src/10.4/sql/sql_base.cc:4377
|
#9 0x56452fd2e3bb in open_and_lock_tables(THD*, DDL_options_st const&, TABLE_LIST*, bool, unsigned int, Prelocking_strategy*) /data/src/10.4/sql/sql_base.cc:5281
|
#10 0x56452fc888b5 in open_and_lock_tables(THD*, TABLE_LIST*, bool, unsigned int) /data/src/10.4/sql/sql_base.h:503
|
#11 0x56452fdf6f67 in mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) /data/src/10.4/sql/sql_insert.cc:764
|
#12 0x56452feb4bb1 in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:4560
|
#13 0x56452feccabe in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:7936
|
#14 0x56452fea37ab in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1839
|
#15 0x56452fea025a in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1357
|
#16 0x564530291855 in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1412
|
#17 0x5645302910f9 in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1316
|
#18 0x5645319473be in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1869
|
#19 0x7f5f1f99a608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477
|
|
Thread T5 created by T0 here:
|
#0 0x7f5f1fabd805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
|
#1 0x5645319477af in spawn_thread_v1 /data/src/10.4/storage/perfschema/pfs.cc:1919
|
#2 0x56452fba9c78 in inline_mysql_thread_create /data/src/10.4/include/mysql/psi/mysql_thread.h:1275
|
#3 0x56452fbc184c in create_thread_to_handle_connection(CONNECT*) /data/src/10.4/sql/mysqld.cc:6259
|
#4 0x56452fbc1fe7 in create_new_thread(CONNECT*) /data/src/10.4/sql/mysqld.cc:6329
|
#5 0x56452fbc24cd in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/10.4/sql/mysqld.cc:6427
|
#6 0x56452fbc3366 in handle_connections_sockets() /data/src/10.4/sql/mysqld.cc:6585
|
#7 0x56452fbc0f51 in mysqld_main(int, char**) /data/src/10.4/sql/mysqld.cc:5917
|
#8 0x56452fba7bec in main /data/src/10.4/sql/main.cc:25
|
#9 0x7f5f1f1080b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
|
|
SUMMARY: AddressSanitizer: use-after-poison /data/src/10.4/sql/opt_range.cc:7806 in Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM*, Field*, Item*)
|
Shadow bytes around the buggy address:
|
0x0c328000a600: 00 00 00 00 00 00 00 00 f7 00 00 00 00 00 00 00
|
0x0c328000a610: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0c328000a620: 00 00 00 00 00 00 f7 00 00 00 00 00 00 00 00 00
|
0x0c328000a630: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0c328000a640: 00 00 f7 00 00 00 04 f7 00 00 f7 f7 f7 f7 f7 f7
|
=>0x0c328000a650: f7 f7 f7 f7 f7 f7 f7[f7]f7 04 fa fa fa fa fa fa
|
0x0c328000a660: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
0x0c328000a670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0c328000a680: 00 f7 00 00 00 00 00 00 00 f7 00 00 00 00 00 00
|
0x0c328000a690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0c328000a6a0: 00 00 f7 00 00 00 00 f7 00 00 00 00 00 00 00 00
|
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
|
Freed heap region: fd
|
Stack left redzone: f1
|
Stack mid redzone: f2
|
Stack right redzone: f3
|
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
|
Shadow gap: cc
|
==1529440==ABORTING
|
Test case 2 |
CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a)); |
INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20); |
|
CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code)); |
INSERT INTO t2 VALUES ('100',1),('111',2); |
|
SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3; |
|
# Cleanup
|
DROP TABLE t1, t2; |
Reproducible with at least MyISAM and InnoDB.
Non-ASAN builds don't crash, at least not on my machine; but non-debug ASAN still fails the same way.
The failure appeared in 10.4 after this commit:
commit 4addd31531f722438b8b702c9cd00c28b61efce3
|
Author: Sergei Petrunia
|
Date: Fri Dec 11 18:54:21 2020 +0300
|
|
MDEV-21958: Query having many NOT-IN clauses running forever
|
And in 10.2 after this:
commit 066212d16cc2b3995e2c53de9e2f799fdab557bd
|
Author: Sergei Petrunia
|
Date: Tue Dec 15 14:38:30 2020 +0300
|
|
MDEV-21958: Query having many NOT-IN clauses running forever
|
Test case 1 fails on 10.4.
Test case 2 fails on 10.2 and 10.4, but not on 10.3.
The patch is not in 10.5 yet, so the failure is not reproducible there.
Attachments
Issue Links
- is caused by
-
MDEV-21958 Query having many NOT-IN clauses running forever and causing available free memory to use completely
- Closed