[MDEV-13907] compoind.test fails in build-bot for bb-10.2-ext Created: 2017-09-26  Updated: 2017-09-26  Resolved: 2017-09-26

Status: Closed
Project: MariaDB Server
Component/s: Stored routines
Affects Version/s: 10.3
Fix Version/s: 10.3.2

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None


 Description   

Starting from the revision 840f1310cb6ee15cffdac5a4d2a95551575b2c3b, the test "compound" fails in build-bot for bb-10.2-ext, with this output:

main.compound                            w2 [ fail ]
        Test ended at 2017-09-23 16:35:33
 
CURRENT_TEST: main.compound
mysqltest: At line 127: query 'prepare stmt from "if fn(?) > 6 then
 begin
  declare a int;
  set a=?*2;
  insert t1 values(a+?);
 end;
end if"' failed: 2013: Lost connection to MySQL server during query
 
The result from queries just before the failure was:
< snip >
executing:	drop table t4
create table t1 (x int)|
create function fn(a int) returns int
begin
insert t1 values (a+7);
return a+8;
end|
reset master|
/**/ if fn(9) > 5 then
select 1;
end if|
1
1
prepare stmt from "if fn(?) > 6 then
 begin
  declare a int;
  set a=?*2;
  insert t1 values(a+?);
 end;
end if"|
 
More results from queries before failure can be found in D:\winx64-debug\build\mysql-test\var\2\log\compound.log
 
 
Server [mysqld.1 - pid: 6604, winpid: 6604, exit: 65280] failed during test run
Server log from this test:
----------SERVER LOG START-----------
2017-09-23 16:35:27 2360 [Note] D:/winx64-debug/build/sql//Debug/mysqld.exe (mysqld 10.2.9-MariaDB-debug-log) starting as process 4540 ...
2017-09-23 16:35:27 2360 [Note] Plugin 'SEQUENCE' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'partition' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'InnoDB' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_DATAFILES' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_TABLESTATS' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_LOCKS' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_MUTEXES' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_CMPMEM' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_CMP_PER_INDEX' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_CMP' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_FT_DELETED' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_CMP_RESET' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_LOCK_WAITS' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_TABLESPACES_ENCRYPTION' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_BUFFER_PAGE_LRU' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_FIELDS' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_CMPMEM_RESET' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'FEEDBACK' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_COLUMNS' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_FT_INDEX_TABLE' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_CMP_PER_INDEX_RESET' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'user_variables' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_FT_INDEX_CACHE' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_FOREIGN_COLS' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_FT_BEING_DELETED' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_BUFFER_POOL_STATS' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_TRX' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_FOREIGN' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_TABLES' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_FT_DEFAULT_STOPWORD' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_FT_CONFIG' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_BUFFER_PAGE' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_TABLESPACES' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_METRICS' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_INDEXES' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_VIRTUAL' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_TABLESPACES_SCRUBBING' is disabled.
2017-09-23 16:35:27 2360 [Note] Plugin 'INNODB_SYS_SEMAPHORE_WAITS' is disabled.
2017-09-23 16:35:27 2360 [Warning] D:/winx64-debug/build/sql//Debug/mysqld.exe: unknown option '--loose-pam-debug'
2017-09-23 16:35:27 2360 [Note] Server socket created on IP: '::'.
2017-09-23 16:35:27 2360 [Note] Reading of all Master_info entries succeded
2017-09-23 16:35:27 2360 [Note] Added new Master_info '' to hash table
2017-09-23 16:35:27 2360 [Note] D:/winx64-debug/build/sql//Debug/mysqld.exe: ready for connections.
Version: '10.2.9-MariaDB-debug-log'  socket: ''  port: 16100  Source distribution
Assertion failed: pos < 0xFFFFFFFFL, file d:\winx64-debug\build\src\sql\sql_lex.h, line 3450
170923 16:35:27 [ERROR] mysqld got exception 0x80000003 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.
 
Server version: 10.2.9-MariaDB-debug-log
key_buffer_size=1048576
read_buffer_size=131072
max_used_connections=2
max_threads=65537
thread_count=3
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 4229 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0xe3b482eed8
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
mysqld.exe!my_sigabrt_handler()[my_thr_init.c:488]
mysqld.exe!raise()[signal.cpp:516]
mysqld.exe!abort()[abort.cpp:71]
mysqld.exe!common_assert_to_stderr<wchar_t>()[assert.cpp:149]
mysqld.exe!_wassert()[assert.cpp:404]
mysqld.exe!LEX::add_placeholder()[sql_lex.h:3450]
mysqld.exe!MYSQLparse()[sql_yacc.yy:13935]
mysqld.exe!parse_sql()[sql_parse.cc:9928]
mysqld.exe!Prepared_statement::prepare()[sql_prepare.cc:3910]
mysqld.exe!mysql_sql_stmt_prepare()[sql_prepare.cc:2823]
mysqld.exe!mysql_execute_command()[sql_parse.cc:3712]
mysqld.exe!mysql_parse()[sql_parse.cc:7896]
mysqld.exe!dispatch_command()[sql_parse.cc:1814]
mysqld.exe!do_command()[sql_parse.cc:1369]
mysqld.exe!threadpool_process_request()[threadpool_common.cc:366]
mysqld.exe!tp_callback()[threadpool_common.cc:192]
mysqld.exe!tp_callback()[threadpool_win.cc:378]
mysqld.exe!work_callback()[threadpool_win.cc:452]
ntdll.dll!RtlFreeUnicodeString()
ntdll.dll!RtlFreeUnicodeString()
KERNEL32.DLL!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0xe3b49e8978): if fn(?) > 6 then
 begin
  declare a int;
  set a=?*2;
  insert t1 values(a+?);
 end;
end if
Connection ID (thread ID): 5
Status: NOT_KILLED



 Comments   
Comment by Alexander Barkov [ 2017-09-26 ]

The problem is that the server tries to create an instance of Item_param with a wrong pos_in_query parameter, when parsing a compound statement with a placeholder in the if part, e.g.:

PREPARE stmt FROM "IF ? > 6 THEN SELECT 1; END IF";

Here's the stack trace:

Item_param::Item_param (this=0x7ffe640156c0, thd=0x7ffe64000a98, pos_in_query_arg=3564209028)

The problem with a wrong pos_in_query is also repeatable in 10.2 and all earlier versions (with no crash however). 840f1310cb6ee15cffdac5a4d2a95551575b2c3b did not introduce the bug, it only revealed the bug by adding DBUG_ASSERT.

Comment by Alexander Barkov [ 2017-09-26 ]

Pushed to bb-10.2.ext

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