mysqltest: At line 51: query 'SELECT a FROM z WHERE testudf(a)>2' failed: 2013: Lost connection to MySQL server during query
|
|
The result from queries just before the failure was:
|
< snip >
|
CREATE VIEW z AS SELECT a FROM x UNION SELECT a FROM y;
|
INSERT INTO x VALUES('cat');
|
INSERT INTO y VALUES('dog');
|
SELECT a,testudf(a) from x;
|
a testudf(a)
|
cat 3
|
SELECT a,testudf(a) from y;
|
a testudf(a)
|
dog 3
|
SELECT a,testudf(a) from z;
|
a testudf(a)
|
cat 3
|
dog 3
|
SELECT a FROM x WHERE testudf(a)>2;
|
a
|
cat
|
SELECT a FROM y WHERE testudf(a)>2;
|
a
|
dog
|
SELECT a FROM z WHERE testudf(a)>2;
|
|
|
Version: '10.2.37-MariaDB-debug-log' socket: '/10.2/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution
|
=================================================================
|
==48816==ERROR: AddressSanitizer: use-after-poison on address 0x62b000005f40 at pc 0x556b28e2f280 bp 0x7f39446b64f0 sp 0x7f39446b64e8
|
READ of size 8 at 0x62b000005f40 thread T5
|
#0 0x556b28e2f27f in udf_handler::cleanup() /10.2/sql/item_func.cc:3432
|
#1 0x556b28e33353 in Item_udf_func::cleanup() /10.2/sql/item_func.cc:3738
|
#2 0x556b28d1b6a3 in Item::cleanup_processor(void*) /10.2/sql/item.cc:680
|
#3 0x556b28454c10 in Item::cleanup_excluding_const_fields_processor(void*) /10.2/sql/item.h:1688
|
#4 0x556b28578214 in Item_func_or_sum::walk(bool (Item::*)(void*), bool, void*) /10.2/sql/item.h:4385
|
#5 0x556b285775e4 in Item_args::walk_args(bool (Item::*)(void*), bool, void*) /10.2/sql/item.h:4097
|
#6 0x556b28578113 in Item_func_or_sum::walk(bool (Item::*)(void*), bool, void*) /10.2/sql/item.h:4383
|
#7 0x556b285fe5bc in pushdown_cond_for_derived(THD*, Item*, TABLE_LIST*) /10.2/sql/sql_derived.cc:1273
|
#8 0x556b28725ef0 in JOIN::optimize_inner() /10.2/sql/sql_select.cc:1400
|
#9 0x556b28722ec9 in JOIN::optimize() /10.2/sql/sql_select.cc:1117
|
#10 0x556b2873e2a6 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*) /10.2/sql/sql_select.cc:3822
|
#11 0x556b2871aff7 in handle_select(THD*, LEX*, select_result*, unsigned long) /10.2/sql/sql_select.cc:361
|
#12 0x556b2868f0d8 in execute_sqlcom_select /10.2/sql/sql_parse.cc:6247
|
#13 0x556b2867a472 in mysql_execute_command(THD*) /10.2/sql/sql_parse.cc:3558
|
#14 0x556b28698451 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /10.2/sql/sql_parse.cc:7762
|
#15 0x556b2866f273 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /10.2/sql/sql_parse.cc:1827
|
#16 0x556b2866bc98 in do_command(THD*) /10.2/sql/sql_parse.cc:1381
|
#17 0x556b28a1324d in do_handle_one_connection(CONNECT*) /10.2/sql/sql_connect.cc:1336
|
#18 0x556b28a12b0e in handle_one_connection /10.2/sql/sql_connect.cc:1241
|
#19 0x556b29eab52f in pfs_spawn_thread /10.2/storage/perfschema/pfs.cc:1869
|
#20 0x7f394ee53fa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
|
#21 0x7f394e7d74ce in clone (/lib/x86_64-linux-gnu/libc.so.6+0xf94ce)
|
|
0x62b000005f40 is located 23872 bytes inside of 24716-byte region [0x62b000000200,0x62b00000628c)
|
allocated by thread T5 here:
|
#0 0x7f394ef56330 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
|
#1 0x556b2a090177 in sf_malloc /10.2/mysys/safemalloc.c:118
|
#2 0x556b2a05d75f in my_malloc /10.2/mysys/my_malloc.c:101
|
#3 0x556b2a03b30c in reset_root_defaults /10.2/mysys/my_alloc.c:147
|
#4 0x556b285b3289 in THD::init_for_queries() /10.2/sql/sql_class.cc:1313
|
#5 0x556b28a12450 in prepare_new_connection_state(THD*) /10.2/sql/sql_connect.cc:1172
|
#6 0x556b28a12b54 in thd_prepare_connection(THD*) /10.2/sql/sql_connect.cc:1256
|
#7 0x556b28a13178 in do_handle_one_connection(CONNECT*) /10.2/sql/sql_connect.cc:1326
|
#8 0x556b28a12b0e in handle_one_connection /10.2/sql/sql_connect.cc:1241
|
#9 0x556b29eab52f in pfs_spawn_thread /10.2/storage/perfschema/pfs.cc:1869
|
#10 0x7f394ee53fa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
|
|
Thread T5 created by T0 here:
|
#0 0x7f394eebddb0 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x50db0)
|
#1 0x556b29eab96b in spawn_thread_v1 /10.2/storage/perfschema/pfs.cc:1919
|
#2 0x556b28400494 in inline_mysql_thread_create /10.2/include/mysql/psi/mysql_thread.h:1246
|
#3 0x556b2841853e in create_thread_to_handle_connection(CONNECT*) /10.2/sql/mysqld.cc:6567
|
#4 0x556b28418c93 in create_new_thread /10.2/sql/mysqld.cc:6637
|
#5 0x556b28419e14 in handle_connections_sockets() /10.2/sql/mysqld.cc:6895
|
#6 0x556b28417921 in mysqld_main(int, char**) /10.2/sql/mysqld.cc:6186
|
#7 0x556b283fede4 in main /10.2/sql/main.cc:25
|
#8 0x7f394e70209a in __libc_start_main ../csu/libc-start.c:308
|
|
SUMMARY: AddressSanitizer: use-after-poison /10.2/sql/item_func.cc:3432 in udf_handler::cleanup()
|
Shadow bytes around the buggy address:
|
0x0c567fff8b90: 00 00 00 00 00 00 00 00 f7 00 00 00 00 00 00 00
|
0x0c567fff8ba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
0x0c567fff8bb0: 00 00 00 00 00 00 00 00 00 f7 00 00 f7 00 00 00
|
0x0c567fff8bc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 00 00
|
0x0c567fff8bd0: f7 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
=>0x0c567fff8be0: 00 00 00 00 00 f7 04 f7[f7]f7 f7 f7 f7 f7 00 f7
|
0x0c567fff8bf0: 00 f7 01 f7 00 f7 00 f7 00 f7 00 00 f7 00 00 00
|
0x0c567fff8c00: 00 00 00 00 00 00 00 00 00 00 00 f7 00 00 00 00
|
0x0c567fff8c10: 00 00 00 00 00 00 00 00 00 00 00 00 f7 00 00 00
|
0x0c567fff8c20: 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 00 00
|
0x0c567fff8c30: f7 00 00 00 00 00 00 00 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
|
==48816==ABORTING
|
----------SERVER LOG END-------------
|
Thanks a lot!
Reproduced as described on 10.2-10.5
10.2 cd1e5d65c6d3aab7f778
mysqltest: At line 51: query 'SELECT a FROM z WHERE testudf(a)>2' failed: 2013: Lost connection to MySQL server during query
The result from queries just before the failure was:
< snip >
CREATE VIEW z AS SELECT a FROM x UNION SELECT a FROM y;
INSERT INTO x VALUES('cat');
INSERT INTO y VALUES('dog');
SELECT a,testudf(a) from x;
a testudf(a)
cat 3
SELECT a,testudf(a) from y;
a testudf(a)
dog 3
SELECT a,testudf(a) from z;
a testudf(a)
cat 3
dog 3
SELECT a FROM x WHERE testudf(a)>2;
a
cat
SELECT a FROM y WHERE testudf(a)>2;
a
dog
SELECT a FROM z WHERE testudf(a)>2;
Version: '10.2.37-MariaDB-debug-log' socket: '/10.2/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution
=================================================================
==48816==ERROR: AddressSanitizer: use-after-poison on address 0x62b000005f40 at pc 0x556b28e2f280 bp 0x7f39446b64f0 sp 0x7f39446b64e8
READ of size 8 at 0x62b000005f40 thread T5
#0 0x556b28e2f27f in udf_handler::cleanup() /10.2/sql/item_func.cc:3432
#1 0x556b28e33353 in Item_udf_func::cleanup() /10.2/sql/item_func.cc:3738
#2 0x556b28d1b6a3 in Item::cleanup_processor(void*) /10.2/sql/item.cc:680
#3 0x556b28454c10 in Item::cleanup_excluding_const_fields_processor(void*) /10.2/sql/item.h:1688
#4 0x556b28578214 in Item_func_or_sum::walk(bool (Item::*)(void*), bool, void*) /10.2/sql/item.h:4385
#5 0x556b285775e4 in Item_args::walk_args(bool (Item::*)(void*), bool, void*) /10.2/sql/item.h:4097
#6 0x556b28578113 in Item_func_or_sum::walk(bool (Item::*)(void*), bool, void*) /10.2/sql/item.h:4383
#7 0x556b285fe5bc in pushdown_cond_for_derived(THD*, Item*, TABLE_LIST*) /10.2/sql/sql_derived.cc:1273
#8 0x556b28725ef0 in JOIN::optimize_inner() /10.2/sql/sql_select.cc:1400
#9 0x556b28722ec9 in JOIN::optimize() /10.2/sql/sql_select.cc:1117
#10 0x556b2873e2a6 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*) /10.2/sql/sql_select.cc:3822
#11 0x556b2871aff7 in handle_select(THD*, LEX*, select_result*, unsigned long) /10.2/sql/sql_select.cc:361
#12 0x556b2868f0d8 in execute_sqlcom_select /10.2/sql/sql_parse.cc:6247
#13 0x556b2867a472 in mysql_execute_command(THD*) /10.2/sql/sql_parse.cc:3558
#14 0x556b28698451 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /10.2/sql/sql_parse.cc:7762
#15 0x556b2866f273 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /10.2/sql/sql_parse.cc:1827
#16 0x556b2866bc98 in do_command(THD*) /10.2/sql/sql_parse.cc:1381
#17 0x556b28a1324d in do_handle_one_connection(CONNECT*) /10.2/sql/sql_connect.cc:1336
#18 0x556b28a12b0e in handle_one_connection /10.2/sql/sql_connect.cc:1241
#19 0x556b29eab52f in pfs_spawn_thread /10.2/storage/perfschema/pfs.cc:1869
#20 0x7f394ee53fa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
#21 0x7f394e7d74ce in clone (/lib/x86_64-linux-gnu/libc.so.6+0xf94ce)
0x62b000005f40 is located 23872 bytes inside of 24716-byte region [0x62b000000200,0x62b00000628c)
allocated by thread T5 here:
#0 0x7f394ef56330 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
#1 0x556b2a090177 in sf_malloc /10.2/mysys/safemalloc.c:118
#2 0x556b2a05d75f in my_malloc /10.2/mysys/my_malloc.c:101
#3 0x556b2a03b30c in reset_root_defaults /10.2/mysys/my_alloc.c:147
#4 0x556b285b3289 in THD::init_for_queries() /10.2/sql/sql_class.cc:1313
#5 0x556b28a12450 in prepare_new_connection_state(THD*) /10.2/sql/sql_connect.cc:1172
#6 0x556b28a12b54 in thd_prepare_connection(THD*) /10.2/sql/sql_connect.cc:1256
#7 0x556b28a13178 in do_handle_one_connection(CONNECT*) /10.2/sql/sql_connect.cc:1326
#8 0x556b28a12b0e in handle_one_connection /10.2/sql/sql_connect.cc:1241
#9 0x556b29eab52f in pfs_spawn_thread /10.2/storage/perfschema/pfs.cc:1869
#10 0x7f394ee53fa2 in start_thread /build/glibc-vjB4T1/glibc-2.28/nptl/pthread_create.c:486
Thread T5 created by T0 here:
#0 0x7f394eebddb0 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x50db0)
#1 0x556b29eab96b in spawn_thread_v1 /10.2/storage/perfschema/pfs.cc:1919
#2 0x556b28400494 in inline_mysql_thread_create /10.2/include/mysql/psi/mysql_thread.h:1246
#3 0x556b2841853e in create_thread_to_handle_connection(CONNECT*) /10.2/sql/mysqld.cc:6567
#4 0x556b28418c93 in create_new_thread /10.2/sql/mysqld.cc:6637
#5 0x556b28419e14 in handle_connections_sockets() /10.2/sql/mysqld.cc:6895
#6 0x556b28417921 in mysqld_main(int, char**) /10.2/sql/mysqld.cc:6186
#7 0x556b283fede4 in main /10.2/sql/main.cc:25
#8 0x7f394e70209a in __libc_start_main ../csu/libc-start.c:308
SUMMARY: AddressSanitizer: use-after-poison /10.2/sql/item_func.cc:3432 in udf_handler::cleanup()
Shadow bytes around the buggy address:
0x0c567fff8b90: 00 00 00 00 00 00 00 00 f7 00 00 00 00 00 00 00
0x0c567fff8ba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c567fff8bb0: 00 00 00 00 00 00 00 00 00 f7 00 00 f7 00 00 00
0x0c567fff8bc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 00 00
0x0c567fff8bd0: f7 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c567fff8be0: 00 00 00 00 00 f7 04 f7[f7]f7 f7 f7 f7 f7 00 f7
0x0c567fff8bf0: 00 f7 01 f7 00 f7 00 f7 00 f7 00 00 f7 00 00 00
0x0c567fff8c00: 00 00 00 00 00 00 00 00 00 00 00 f7 00 00 00 00
0x0c567fff8c10: 00 00 00 00 00 00 00 00 00 00 00 00 f7 00 00 00
0x0c567fff8c20: 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 00 00
0x0c567fff8c30: f7 00 00 00 00 00 00 00 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
==48816==ABORTING
----------SERVER LOG END-------------
on second thought, the bug is reproducible also using any udf from already existing in udf.test, e.g.
Version: '10.5.9-MariaDB-debug-log'
=================================================================
==780812==ERROR: AddressSanitizer: use-after-poison on address 0x629000367228 at pc 0x560b0373287e bp 0x7f7af138d180 sp 0x7f7af138d170
READ of size 8 at 0x629000367228 thread T5
#0 0x560b0373287d in udf_handler::cleanup() /git/10.5/sql/item_func.cc:3429
#1 0x560b037365bb in Item_udf_func::cleanup() /git/10.5/sql/item_func.cc:3734
#2 0x560b02cb7f6b in Item::delete_self() /git/10.5/sql/item.h:2306
#3 0x560b02c9a3b8 in Query_arena::free_items() /git/10.5/sql/sql_class.cc:3776
#4 0x560b02c8c151 in THD::cleanup_after_query() /git/10.5/sql/sql_class.cc:2314
#5 0x560b02dd6a9f in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /git/10.5/sql/sql_parse.cc:8077
#6 0x560b02dac978 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /git/10.5/sql/sql_parse.cc:1872
#7 0x560b02da92a1 in do_command(THD*) /git/10.5/sql/sql_parse.cc:1353
#8 0x560b031eb533 in do_handle_one_connection(CONNECT*, bool) /git/10.5/sql/sql_connect.cc:1410
#9 0x560b031eae97 in handle_one_connection /git/10.5/sql/sql_connect.cc:1312
#10 0x560b03ef2f0a in pfs_spawn_thread /git/10.5/storage/perfschema/pfs.cc:2201
#11 0x7f7afabb5608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477
#12 0x7f7afa789292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)