[MDEV-15037] JOIN::optimize() crash in case of in or exists Created: 2018-01-22  Updated: 2018-02-19  Resolved: 2018-02-19

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.2.11, 10.2.12
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Daniel Wolf Assignee: Oleksandr Byelkin
Resolution: Duplicate Votes: 0
Labels: crash, optimizer
Environment:

Windows 7 64 bit; Windows Server 2016 64 bit


Attachments: JPEG File 2018-01-22, 11_49_03.jpg     File VTT-WDANIEL1.err     File my.ini     Text File show_variables.txt    
Issue Links:
Duplicate
duplicates MDEV-14857 problem with 10.2.11 server crashing ... Closed

 Description   

I made backup from 10.1.28, and have made some changes because there is a new reserved keyword "rows".
I download mariadb-10.2.12-winx64.msi installer and imported the backup, it was O.K. after a while the server reserved a lot of memory and crashed it.
It seems that it is related with:
profileringtransfer.controlled_profile_id in (SELECT originalid FROM tmp_profileid_cloneid)

After some try I see that in 10.2.2 it was good, from 10.2.3 there are failures.

How to reproduce:
1. Install mariadb-10.2.12-winx64.msi. Nothing changed during the process.
2. I personally used Mysql Workbench login as root.
2. Create database osx;
3. use osx;
4. import database Dump20180119-2.zip
call stored procedure:
5. Call create_profile_working_copies('8589937224');
after a while a response came
Error Code: 2013. Lost connection to MySQL server during query
run out of memory and Mariadb stopped.

If you want to reproduce again you have to import again the database and call again
Call create_profile_working_copies('8589937224');

The scenario is always reproducable.
I enclosed show_variables.txt, my.ini, errolog and hardware configuration.
I put database dump, into ftp.askmonty.org today as Dump20180119-2.zip.

Here is the exception:

2018-01-22 14:38:14 5448 [ERROR] mysqld.exe: Out of memory (Needed 3828848512 bytes)
2018-01-22 14:38:14 5448 [ERROR] mysqld.exe: Out of memory (Needed 3828848512 bytes)
180122 14:38:14 [ERROR] mysqld got exception 0xc0000005 ;
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.12-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=5
max_threads=65537
thread_count=10
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 136057 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x24745b18
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!memset()[memset.asm:127]
mysqld.exe!set_dynamic()[array.c:204]
mysqld.exe!Explain_query::add_node()[sql_explain.cc:122]
mysqld.exe!JOIN::save_explain_data_intern()[sql_select.cc:24890]
mysqld.exe!JOIN::save_explain_data()[sql_select.cc:3313]
mysqld.exe!JOIN::optimize()[sql_select.cc:1110]
mysqld.exe!st_select_lex::optimize_unflattened_subqueries()[sql_lex.cc:3848]
mysqld.exe!JOIN::optimize_inner()[sql_select.cc:2009]
mysqld.exe!JOIN::optimize()[sql_select.cc:1101]
mysqld.exe!???[sql_select.cc:3711]
mysqld.exe!handle_select()[sql_select.cc:361]
mysqld.exe!mysql_execute_command()[sql_parse.cc:4523]
mysqld.exe!sp_instr_stmt::exec_core()[sp_head.cc:3266]
mysqld.exe!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:3027]
mysqld.exe!sp_instr_stmt::execute()[sp_head.cc:3180]
mysqld.exe!sp_head::execute()[sp_head.cc:1336]
mysqld.exe!sp_head::execute_procedure()[sp_head.cc:2135]
mysqld.exe!do_execute_sp()[sql_parse.cc:2888]
mysqld.exe!mysql_execute_command()[sql_parse.cc:5809]
mysqld.exe!sp_instr_stmt::exec_core()[sp_head.cc:3266]
mysqld.exe!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:3027]
mysqld.exe!sp_instr_stmt::execute()[sp_head.cc:3180]
mysqld.exe!sp_head::execute()[sp_head.cc:1336]
mysqld.exe!sp_head::execute_procedure()[sp_head.cc:2135]
mysqld.exe!do_execute_sp()[sql_parse.cc:2888]
mysqld.exe!mysql_execute_command()[sql_parse.cc:5809]
mysqld.exe!sp_instr_stmt::exec_core()[sp_head.cc:3266]
mysqld.exe!sp_lex_keeper::reset_lex_and_exec_core()[sp_head.cc:3027]
mysqld.exe!sp_instr_stmt::execute()[sp_head.cc:3180]
mysqld.exe!sp_head::execute()[sp_head.cc:1336]
mysqld.exe!sp_head::execute_procedure()[sp_head.cc:2135]
mysqld.exe!do_execute_sp()[sql_parse.cc:2888]
mysqld.exe!mysql_execute_command()[sql_parse.cc:5809]
mysqld.exe!mysql_parse()[sql_parse.cc:7905]
mysqld.exe!dispatch_command()[sql_parse.cc:1807]
mysqld.exe!do_command()[sql_parse.cc:1359]
mysqld.exe!threadpool_process_request()[threadpool_common.cc:366]
mysqld.exe!tp_callback()[threadpool_common.cc:192]
ntdll.dll!TpPostWork()
ntdll.dll!RtlRealSuccessor()
kernel32.dll!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x31c4ef50): INSERT INTO profileringtransfer 
                SELECT GetCloneId(profileringtransfer.feature_id), 
                       profileringtransfer.ringtransfer_action_id, 
                       CASE 
                         WHEN profileringtransfer.controlled_profile_id in (SELECT originalid FROM tmp_profileid_cloneid)
                         THEN GetCloneId(profileringtransfer.controlled_profile_id) 
                         ELSE profileringtransfer.controlled_profile_id 
                       END, 
                       profileringtransfer.text, 
                       profileringtransfer.onlysignalisation 
                FROM   profileringtransfer 
                       JOIN tmp_feature 
                         ON profileringtransfer.feature_id = tmp_feature.id
Connection ID (thread ID): 82
Status: NOT_KILLED
 
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on
 
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.



 Comments   
Comment by Elena Stepanova [ 2018-01-22 ]

This must be the same problem as MDEV-14857, please track further progress there.
It is expected to be fixed in the next 10.1/10.2 releases.

Comment by Elena Stepanova [ 2018-01-23 ]

While it is supposedly a duplicate of MDEV-14857 and shouldn't require a separate fix, I'm assigning it to sanja to make sure that after MDEV-14857 is fixed, this variation has also been checked.

Comment by Daniel Wolf [ 2018-02-19 ]

I have checked that it is corrected in 10.2.13. Thanks.

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