[MDEV-26432] MariaDB Server SEGV issue Created: 2021-08-19  Updated: 2021-08-25  Resolved: 2021-08-25

Status: Closed
Project: MariaDB Server
Component/s: N/A
Affects Version/s: 10.7.0
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Jingzhou Fu Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Linux version 5.13.0-1-MANJARO (builduser@LEGION) (gcc (GCC) 11.1.0, GNU ld (GNU Binutils) 2.36.1) #1 SMP PREEMPT Mon Jun 7 06:16:10 UTC 2021 x86_64


Issue Links:
Duplicate
duplicates MDEV-26437 Server crashes in Item_args::walk_args Closed

 Description   

step to reproduce:

CREATE TABLE v0 ( v2 INT KEY , v1 INT AS ( ( USER ( ) LIKE 'x' ) ) ) ;
 CREATE VIEW v3 AS SELECT * FROM v0 WITH CASCADED CHECK OPTION ;
 SELECT 127 FROM v0 WHERE 68059648.000000 BETWEEN v2 AND v1 ;
 CREATE VIEW v4 AS SELECT * FROM v0 UNION SELECT * FROM v0 ;
 SELECT * FROM v4 ORDER BY v1 DESC LIMIT 66 ;
 CREATE TABLE v5 ( v7 YEAR , v6 INT ) ;
 CREATE TABLE v8 ( v9 INT NOT NULL ) ;

report (compiled with ASAN):

Server version: 10.7.0-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=1
max_threads=153
thread_count=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467956 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x62b0000bd218
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...
stack_bottom = 0x7f7dbf7c4850 thread_stack 0x5fc00
sanitizer_common/sanitizer_common_interceptors.inc:4203(__interceptor_backtrace.part.0)[0x7f7ddf070c3e]
mysys/stacktrace.c:213(my_print_stacktrace)[0x55a302ae5747]
sql/signal_handler.cc:222(handle_fatal_signal)[0x55a301aad120]
sigaction.c:0(__restore_rt)[0x7f7ddea5a870]
sql/item.h:2742(Item_args::walk_args(bool (Item::*)(void*), bool, void*))[0x55a3010a6b2f]
sql/sql_base.cc:8230(insert_fields(THD*, Name_resolution_context*, char const*, char const*, List_iterator<Item>*, bool, unsigned int*, bool))[0x55a3011dfc12]
sql/sql_base.cc:7598(setup_wild(THD*, TABLE_LIST*, List<Item>&, List<Item>*, st_select_lex*, bool))[0x55a3011e13bb]
sql/sql_select.cc:1376(JOIN::prepare(TABLE_LIST*, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x55a3014979ec]
sql/sql_union.cc:1091(st_select_lex_unit::prepare_join(THD*, st_select_lex*, select_result*, unsigned long long, bool))[0x55a3015fa7be]
sql/sql_union.cc:1560(st_select_lex_unit::prepare(TABLE_LIST*, select_result*, unsigned long long))[0x55a301606898]
sql/sql_view.cc:544(mysql_create_view(THD*, TABLE_LIST*, enum_view_create_mode))[0x55a3016451d4]
sql/sql_parse.cc:5799(mysql_execute_command(THD*, bool))[0x55a30134827f]
sql/sql_parse.cc:8047(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x55a3013525a1]
sql/sql_parse.cc:1898(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x55a30135860c]
sql/sql_parse.cc:1406(do_command(THD*, bool))[0x55a30135d73d]
sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x55a301718e57]
sql/sql_connect.cc:1312(handle_one_connection)[0x55a30171933d]
perfschema/pfs.cc:2204(pfs_spawn_thread)[0x55a3021a9c2c]
pthread_create.c:0(start_thread)[0x7f7ddea50259]
:0(__GI___clone)[0x7f7dde5fb5e3]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x629000087238): CREATE VIEW v4 AS SELECT * FROM v0 UNION SELECT * FROM v0
 
Connection ID (thread ID): 4
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=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
 
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /home/fuboat/mariadb-tmp/15
Resource Limits:
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            8388608              unlimited            bytes     
Max core file size        unlimited            unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             61608                61608                processes 
Max open files            524288               524288               files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       61608                61608                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us        
Core pattern: core

gdb bt:

Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/usr/local/mysql/bin//mysqld --port 10015 --datadir=/home/fuboat/mariadb-tmp/15'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f7ddea57808 in pthread_kill () from /usr/lib/libpthread.so.0
#1  0x000055a301aad06b in handle_fatal_signal (sig=<optimized out>) at /experiment/mariadb-server/sql/signal_handler.cc:344
#2  <signal handler called>
#3  0x000055a3010a6b2f in Item_args::walk_args (arg=0x0, walk_subquery=<optimized out>, processor=<optimized out>, this=0x6190000a5320) at /experiment/mariadb-server/sql/item.h:2742
#4  Item_func_like::walk (this=0x6190000a52b0, processor=<optimized out>, walk_subquery=<optimized out>, arg=0x0) at /experiment/mariadb-server/sql/item_cmpfunc.h:2960
#5  0x000055a3011dfc12 in insert_fields (thd=<optimized out>, context=<optimized out>, db_name=0x0, table_name=<optimized out>, it=<optimized out>, any_privileges=<optimized out>, hidden_bit_fields=<optimized out>, returning_field=<optimized out>) at /experiment/mariadb-server/sql/item.h:7745
#6  0x000055a3011e13bb in setup_wild (thd=thd@entry=0x62b0000bd218, tables=<optimized out>, fields=..., sum_func_list=sum_func_list@entry=0x62900008a850, select_lex=<optimized out>, returning_field=returning_field@entry=false) at /experiment/mariadb-server/sql/sql_base.cc:7598
#7  0x000055a3014979ec in JOIN::prepare (this=this@entry=0x62900008a4f8, tables_init=<optimized out>, conds_init=<optimized out>, og_num=<optimized out>, order_init=<optimized out>, skip_order_by=<optimized out>, group_init=<optimized out>, having_init=<optimized out>, proc_param_init=<optimized out>, 
    select_lex_arg=<optimized out>, unit_arg=<optimized out>) at /experiment/mariadb-server/sql/sql_select.cc:1376
#8  0x000055a3015fa7be in st_select_lex_unit::prepare_join (this=0x62b0000c13c0, thd_arg=0x62b0000bd218, sl=0x629000087aa8, tmp_result=0x62900008a408, additional_options=<optimized out>, is_union_select=<optimized out>) at /experiment/mariadb-server/sql/sql_union.cc:1091
#9  0x000055a301606898 in st_select_lex_unit::prepare (this=this@entry=0x62b0000c13c0, derived_arg=<optimized out>, sel_result=sel_result@entry=0x0, additional_options=additional_options@entry=0) at /experiment/mariadb-server/sql/sql_union.cc:1560
#10 0x000055a3016451d4 in mysql_create_view (thd=thd@entry=0x62b0000bd218, views=views@entry=0x6290000873b0, mode=<optimized out>) at /experiment/mariadb-server/sql/sql_view.cc:544
#11 0x000055a30134827f in mysql_execute_command (thd=0x62b0000bd218, is_called_from_prepared_stmt=<optimized out>) at /experiment/mariadb-server/sql/sql_parse.cc:5799
#12 0x000055a3013525a1 in mysql_parse (thd=0x62b0000bd218, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /experiment/mariadb-server/sql/sql_parse.cc:8030
#13 0x000055a30135860c in dispatch_command (command=<optimized out>, thd=0x62b0000bd218, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /experiment/mariadb-server/sql/sql_parse.cc:1896
#14 0x000055a30135d73d in do_command (thd=0x62b0000bd218, blocking=blocking@entry=true) at /experiment/mariadb-server/sql/sql_parse.cc:1404
#15 0x000055a301718e57 in do_handle_one_connection (connect=<optimized out>, put_in_cache=<optimized out>) at /experiment/mariadb-server/sql/sql_connect.cc:1418
#16 0x000055a30171933d in handle_one_connection (arg=arg@entry=0x6080000023b8) at /experiment/mariadb-server/sql/sql_connect.cc:1312
#17 0x000055a3021a9c2c in pfs_spawn_thread (arg=0x617000005f18) at /experiment/mariadb-server/storage/perfschema/pfs.cc:2201
#18 0x00007f7ddea50259 in start_thread () from /usr/lib/libpthread.so.0
#19 0x00007f7dde5fb5e3 in clone () from /usr/lib/libc.so.6



 Comments   
Comment by Alice Sherepa [ 2021-08-25 ]

Thank you for the report! the problem is the same as MDEV-26437

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