Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.4, 10.5, 10.6
-
None
Description
If the problem is limited to the low value of join_buffer_space_limit, it can be considered a corner case; but it could be scalable, so it is worth checking at least.
CREATE TABLE t1 (a varchar(10)) ENGINE=MyISAM; |
INSERT INTO t1 VALUES ('foo'),('bar'); |
|
CREATE TABLE t2 (b varchar(1024)) ENGINE=MyISAM; |
INSERT INTO t2 VALUES ('baz'); |
|
CREATE TABLE t3 (c int) ENGINE=MyISAM; |
INSERT INTO t3 VALUES (1),(2); |
|
CREATE TABLE t4 (d int, e varchar(1024)) ENGINE=MyISAM; |
INSERT INTO t4 VALUES (1,'foo'),(2,'bar'); |
|
CREATE TABLE t5 (f int) ENGINE=MyISAM; |
INSERT INTO t5 VALUES (3); |
|
CREATE TABLE t6 (g varchar(1024)) ENGINE=MyISAM; |
INSERT INTO t6 VALUES ('qux'),('foobar'); |
|
SET SESSION join_buffer_space_limit= 16384; |
SET SESSION join_cache_level= 5; |
|
SELECT STRAIGHT_JOIN t6.* FROM t1 LEFT JOIN t2 ON t2.b = t1.a LEFT JOIN t3 JOIN t4 ON t3.c = t4.d JOIN t5 ON t4.d = t5.f ON t2.b = t4.e LEFT JOIN t6 ON t6.g = t4.e; |
|
# Cleanup
|
DROP TABLE t1, t2, t3, t4, t5, t6; |
10.4 e8b05ce5 |
==1872015==ERROR: AddressSanitizer: requested allocation size 0xffffffffffffffd4 (0x7d8 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T5)
|
#0 0x7fc320717bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
|
#1 0x55917545dc44 in sf_malloc /data/src/10.4/mysys/safemalloc.c:118
|
#2 0x55917542becb in my_malloc /data/src/10.4/mysys/my_malloc.c:101
|
#3 0x559173b5f427 in JOIN_CACHE::alloc_buffer() /data/src/10.4/sql/sql_join_cache.cc:940
|
#4 0x559173b5fc20 in JOIN_CACHE::init(bool) /data/src/10.4/sql/sql_join_cache.cc:1072
|
#5 0x559173b69937 in JOIN_CACHE_HASHED::init(bool) /data/src/10.4/sql/sql_join_cache.cc:2687
|
#6 0x559173b6e079 in JOIN_CACHE_BNLH::init(bool) /data/src/10.4/sql/sql_join_cache.cc:3814
|
#7 0x559173791c0d in JOIN::init_join_caches() /data/src/10.4/sql/sql_select.cc:1782
|
#8 0x55917379eb64 in JOIN::optimize_stage2() /data/src/10.4/sql/sql_select.cc:3011
|
#9 0x55917379735d in JOIN::optimize_inner() /data/src/10.4/sql/sql_select.cc:2294
|
#10 0x559173790041 in JOIN::optimize() /data/src/10.4/sql/sql_select.cc:1615
|
#11 0x5591737b0b15 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:4681
|
#12 0x55917378249f in handle_select(THD*, LEX*, select_result*, unsigned long) /data/src/10.4/sql/sql_select.cc:410
|
#13 0x5591736f3621 in execute_sqlcom_select /data/src/10.4/sql/sql_parse.cc:6355
|
#14 0x5591736e0eef in mysql_execute_command(THD*) /data/src/10.4/sql/sql_parse.cc:3889
|
#15 0x5591736fc9ef in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.4/sql/sql_parse.cc:7896
|
#16 0x5591736d3aad in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.4/sql/sql_parse.cc:1834
|
#17 0x5591736d0579 in do_command(THD*) /data/src/10.4/sql/sql_parse.cc:1352
|
#18 0x559173abc9f6 in do_handle_one_connection(CONNECT*) /data/src/10.4/sql/sql_connect.cc:1412
|
#19 0x559173abc29a in handle_one_connection /data/src/10.4/sql/sql_connect.cc:1316
|
#20 0x55917515106e in pfs_spawn_thread /data/src/10.4/storage/perfschema/pfs.cc:1869
|
#21 0x7fc320521608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477
|
|
==1872015==HINT: if you don't care about these errors you may set allocator_may_return_null=1
|
SUMMARY: AddressSanitizer: allocation-size-too-big (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8) in malloc
|
Thread T5 created by T0 here:
|
#0 0x7fc320644805 in pthread_create (/lib/x86_64-linux-gnu/libasan.so.5+0x3a805)
|
#1 0x55917515145f in spawn_thread_v1 /data/src/10.4/storage/perfschema/pfs.cc:1919
|
#2 0x5591733ddf88 in inline_mysql_thread_create /data/src/10.4/include/mysql/psi/mysql_thread.h:1275
|
#3 0x5591733f5976 in create_thread_to_handle_connection(CONNECT*) /data/src/10.4/sql/mysqld.cc:6259
|
#4 0x5591733f6107 in create_new_thread(CONNECT*) /data/src/10.4/sql/mysqld.cc:6329
|
#5 0x5591733f65e6 in handle_accepted_socket(st_mysql_socket, st_mysql_socket) /data/src/10.4/sql/mysqld.cc:6427
|
#6 0x5591733f7477 in handle_connections_sockets() /data/src/10.4/sql/mysqld.cc:6585
|
#7 0x5591733f5095 in mysqld_main(int, char**) /data/src/10.4/sql/mysqld.cc:5917
|
#8 0x5591733dbf4c in main /data/src/10.4/sql/main.cc:25
|
#9 0x7fc31fffa0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
|
|
==1872015==ABORTING
|
10.4 valgrind 29847a37 |
==1871905== Thread 6:
|
==1871905== Argument 'size' of function malloc has a fishy (possibly negative) value: -152
|
==1871905== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
|
==1871905== by 0x168728E: my_malloc (my_malloc.c:101)
|
==1871905== by 0xB2CEB5: JOIN_CACHE::alloc_buffer() (sql_join_cache.cc:940)
|
==1871905== by 0xB2D26E: JOIN_CACHE::init(bool) (sql_join_cache.cc:1072)
|
==1871905== by 0xB30AAA: JOIN_CACHE_HASHED::init(bool) (sql_join_cache.cc:2687)
|
==1871905== by 0xB323B3: JOIN_CACHE_BNLH::init(bool) (sql_join_cache.cc:3814)
|
==1871905== by 0x99ACB8: JOIN::init_join_caches() (sql_select.cc:1782)
|
==1871905== by 0x99F4BA: JOIN::optimize_stage2() (sql_select.cc:3011)
|
==1871905== by 0x99CC2D: JOIN::optimize_inner() (sql_select.cc:2294)
|
==1871905== by 0x99A3E2: JOIN::optimize() (sql_select.cc:1615)
|
==1871905== by 0x9A5A54: 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*) (sql_select.cc:4681)
|
==1871905== by 0x995354: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:410)
|
==1871905== by 0x95A4F9: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:6355)
|
==1871905== by 0x950A49: mysql_execute_command(THD*) (sql_parse.cc:3889)
|
==1871905== by 0x95E504: mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) (sql_parse.cc:7896)
|
==1871905== by 0x94A8C3: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) (sql_parse.cc:1834)
|
^ Found warnings in /data/bld/10.4-valgrind/mysql-test/var/log/mysqld.1.err
|
Plan |
EXPLAIN EXTENDED SELECT STRAIGHT_JOIN t6.* FROM t1 LEFT JOIN t2 ON t2.b = t1.a LEFT JOIN t3 JOIN t4 ON t3.c = t4.d JOIN t5 ON t4.d = t5.f ON t2.b = t4.e LEFT JOIN t6 ON t6.g = t4.e; |
id select_type table type possible_keys key key_len ref rows filtered Extra |
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 |
1 SIMPLE t2 hash_ALL NULL #hash#$hj 1027 test.t1.a 1 100.00 Using where; Using join buffer (flat, BNLH join) |
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) |
1 SIMPLE t4 hash_ALL NULL #hash#$hj 1032 test.t2.b,test.t3.c 2 100.00 Using where; Using join buffer (incremental, BNLH join) |
1 SIMPLE t5 hash_ALL NULL #hash#$hj 5 test.t3.c 1 100.00 Using where; Using join buffer (incremental, BNLH join) |
1 SIMPLE t6 hash_ALL NULL #hash#$hj 1027 test.t4.e 2 100.00 Using where; Using join buffer (incremental, BNLH join) |
Warnings:
|
Note 1003 select straight_join `test`.`t6`.`g` AS `g` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) left join (`test`.`t3` join `test`.`t4` join `test`.`t5`) on(`test`.`t4`.`e` = `test`.`t2`.`b` and `test`.`t4`.`d` = `test`.`t3`.`c` and `test`.`t5`.`f` = `test`.`t3`.`c` and `test`.`t2`.`b` is not null and `test`.`t3`.`c` is not null and `test`.`t3`.`c` is not null) left join `test`.`t6` on(`test`.`t6`.`g` = `test`.`t4`.`e` and `test`.`t4`.`e` is not null) where 1 |
Reproducible on 10.4-10.5.
Couldn't reproduce on 10.3, although maybe I failed to find the right optimizer settings for that.