[MDEV-15840] Recursive query using temp table random crash Created: 2018-04-10  Updated: 2019-01-02  Resolved: 2018-04-17

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - CTE
Affects Version/s: 10.3.5, 10.2, 10.3
Fix Version/s: 10.2.15

Type: Bug Priority: Major
Reporter: Duncan Kampert Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None
Environment:

Linux Centos 7.0 / Ubuntu 16.04


Attachments: File templatevalues.sql    
Issue Links:
Duplicate
is duplicated by MDEV-16867 Recursive query leads to endless exec... Closed
Relates
relates to MDEV-15556 MariaDB crash with big_tables=1 and CTE Closed

 Description   

For our data we use a recursive query to group the data together.
We have created a stored procedure which calls all of our required queries together for quicker processing.

We create a temporary table which extracts the important information from the table, and then we run a recursive query on the table, which can be seen as taking all children and all parents from a node in a tree.

When running these components separately, we get the correct results in little time without crashing. However when running this query in a stored procedure it has one of three possible outcomes:
It runs the query as desired in very little time,
It crashes and gives an out of memory error: (ERROR 5 (HY000): Out of memory (Needed 19091736 bytes))
It crashes and gives a too big key error: (ERROR 1815 (HY000): Internal error: Using too big key for internal temp tables)

I have included a portion of the table which also gives the same error, it also creates the stored procedure.
To generate the errors call the following query a few times:
call getNums('3', '49d18acc-d3aa-45db-9efd-6d1a66971964');



 Comments   
Comment by Alice Sherepa [ 2018-04-13 ]

Thanks for the report!
The problem is reproducible with stored procedure and recursive cte on MariaDB 10.3, 10.2 (on 10.2 testcase is sporadic, run it with --repeat=N)
Nothing in error log, no coredump, 2013: Lost connection to MySQL server, with --valgrind fails with "out of memory"

testcase 1:

--source include/have_sequence.inc
 
CREATE TABLE t1 (p1 text,k2 int, p2 text, k1 int);
INSERT INTO t1 select seq,seq,seq,seq from seq_1_to_1000;
 
DELIMITER &;
CREATE PROCEDURE getNums()
BEGIN
WITH RECURSIVE cte as 
(SELECT * FROM t1  UNION SELECT c.* FROM t1 c JOIN cte p ON c.p1 = p.p2 AND c.k2 = p.k1) SELECT * FROM cte ;
END &
 
DELIMITER ;&
call getNums();

Results of test from 10.2 unstable - sometimes test passes, sometimes server crashed, or errors:

main.1stmy                               [ fail ]
        Test ended at 2018-04-13 13:04:12
 
CURRENT_TEST: main.1stmy
mysqltest: At line 14: query 'call getNums()' failed: 1034: Duplicate key  1 for record at 257 against record at 256
 
Warnings from just before the error:
Error 1034 Duplicate key  1 for record at 257 against record at 256 
Error 1034 Quick-recover aborted; Run recovery without switch -q or with switch -qq 
Error 1034 Create index by sort failed 
Error 1034 Duplicate key  1 for record at 257 against new record at 256
 
2018-04-13 13:04:12 139711026255616 [Warning] Warning: Enabling keys got errno 137 on .p, retrying

CURRENT_TEST: main.1stmy
mysqltest: At line 14: query 'call getNums()' failed: 1815: Internal error: Using too big key for internal temp tables

Another testcase -only cte, not from inside stored procedure -failed on 10.3, could not reproduce it on 10.2:

--source include/have_sequence.inc
 
CREATE TABLE t1 (p1 text,k2 int, p2 text, k1 int);
INSERT INTO t1 select seq,seq,seq,seq from seq_1_to_1000;
 
WITH RECURSIVE cte as 
(SELECT * FROM t1 
	UNION SELECT c.* FROM t1 c JOIN cte ON c.p1 = cte.p2 AND c.k2 = cte.k1) SELECT * FROM cte ;

CURRENT_TEST: main.1b
mysqltest: At line 7: query 'WITH RECURSIVE cte as 
(SELECT * FROM t1 
UNION SELECT c.* FROM t1 c JOIN cte ON c.p1 = cte.p2 AND c.k2 = cte.k1) SELECT * FROM cte ' failed: 5: Out of memory (Needed 3031741624 bytes)

Comment by Alice Sherepa [ 2018-04-13 ]

from 10.2:

==11668== Thread 6:
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0xBF09CB: alloc_root (my_alloc.c:222)
==11668==    by 0x5F0CAA: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17537)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0xBF09E7: alloc_root (my_alloc.c:260)
==11668==    by 0x5F0CAA: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17537)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0x4C344FC: memset (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11668==    by 0x5F0CC4: memset (string3.h:90)
==11668==    by 0x5F0CC4: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17541)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0x4C3454D: memset (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11668==    by 0x5F0CC4: memset (string3.h:90)
==11668==    by 0x5F0CC4: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17541)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0x5F0CF8: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17549)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668==    by 0x8423E6: sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) (sp_head.cc:3009)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0x5F1024: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17548)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668==    by 0x8423E6: sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) (sp_head.cc:3009)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0x5F0DBE: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17583)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668==    by 0x8423E6: sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) (sp_head.cc:3009)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0xB1F085: maria_create (ma_create.c:568)
==11668==    by 0x5F0C16: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17665)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0xB1EE69: maria_create (ma_create.c:661)
==11668==    by 0x5F0C16: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17665)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Syscall param write(buf) points to uninitialised byte(s)
==11668==    at 0x5D4F4BD: ??? (syscall-template.S:84)
==11668==    by 0xBFA45C: my_write (my_write.c:49)
==11668==    by 0xB45BDB: inline_mysql_file_write (mysql_file.h:1131)
==11668==    by 0xB45BDB: _ma_keydef_write (ma_open.c:1697)
==11668==    by 0xB20278: maria_create (ma_create.c:942)
==11668==    by 0x5F0C16: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17665)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==  Address 0x412bb20 is on thread 6's stack
==11668==  in frame #2, created by _ma_keydef_write (mysql_file.h:1686)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0xB20289: maria_create (ma_create.c:944)
==11668==    by 0x5F0C16: create_internal_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:17665)
==11668==    by 0x5F281F: instantiate_tmp_table(TABLE*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long) (sql_select.cc:18345)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0xBF09CB: alloc_root (my_alloc.c:222)
==11668==    by 0x7401D0: handler::ha_open(TABLE*, char const*, int, unsigned int) (handler.cc:2534)
==11668==    by 0x5F0A59: open_tmp_table(TABLE*) (sql_select.cc:17469)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0xBF09E7: alloc_root (my_alloc.c:260)
==11668==    by 0x7401D0: handler::ha_open(TABLE*, char const*, int, unsigned int) (handler.cc:2534)
==11668==    by 0x5F0A59: open_tmp_table(TABLE*) (sql_select.cc:17469)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668== Conditional jump or move depends on uninitialised value(s)
==11668==    at 0x7401D8: handler::ha_open(TABLE*, char const*, int, unsigned int) (handler.cc:2534)
==11668==    by 0x5F0A59: open_tmp_table(TABLE*) (sql_select.cc:17469)
==11668==    by 0x6D28CD: With_element::instantiate_tmp_tables() (sql_cte.cc:1403)
==11668==    by 0x59750E: TABLE_LIST::fill_recursive(THD*) (sql_derived.cc:1023)
==11668==    by 0x59792A: mysql_derived_fill(THD*, LEX*, TABLE_LIST*) (sql_derived.cc:1097)
==11668==    by 0x597486: mysql_handle_single_derived(LEX*, TABLE_LIST*, unsigned int) (sql_derived.cc:197)
==11668==    by 0x5EB27E: st_join_table::preread_init() (sql_select.cc:11942)
==11668==    by 0x5EB557: sub_select(JOIN*, st_join_table*, bool) (sql_select.cc:18659)
==11668==    by 0x6090E1: do_select (sql_select.cc:18235)
==11668==    by 0x6090E1: JOIN::exec_inner() (sql_select.cc:3566)
==11668==    by 0x609288: JOIN::exec() (sql_select.cc:3361)
==11668==    by 0x6093CD: 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:3761)
==11668==    by 0x609D0D: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:376)
==11668==    by 0x507FF5: execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.191] (sql_parse.cc:6468)
==11668==    by 0x5BE214: mysql_execute_command(THD*) (sql_parse.cc:3479)
==11668==    by 0x83C693: sp_instr_stmt::exec_core(THD*, unsigned int*) (sp_head.cc:3246)
==11668==    by 0x8423E6: sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*) (sp_head.cc:3009)
^ Found warnings in /home/alice/git/10.2/mysql-test/var/log/mysqld.1.err

Comment by Igor Babaev [ 2018-04-17 ]

The cause of this bug was the same as for the bug MDEV-15556.
So it was fixed by the patch for MDEV-15556.

Generated at Thu Feb 08 08:24:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.