[MDEV-26430] 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-26061 MariaDB server crash at Field::set_de... Closed

 Description   

step to reproduce:

CREATE TABLE v0 ( v1 TIMESTAMP , CODE INT NULL CHECK ( ( ceil ( ( ( ( DEFAULT ( v1 ) ) ) OR v1 = -1 ) ) = NULL ) ) ) ;
 COMMIT ;
 DELETE v0 FROM v0 WHERE v1 BETWEEN 0 AND SIN ( 'x' / 92 ) ;
 INSERT v0 VALUES ( NULL , 0 ) ;
 ALTER TABLE v0 ADD v0 TIME DEFAULT ( FIND_IN_SET ( v1 , 'x' ) + ( v1 = 34 AND ( v1 = v1 OR v1 = 2147483647 ) ) ) ;
 ROLLBACK TO SAVEPOINT v0 ;

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 = 0x7f84025ed850 thread_stack 0x5fc00
sanitizer_common/sanitizer_common_interceptors.inc:4203(__interceptor_backtrace.part.0)[0x7f8421e99c3e]
mysys/stacktrace.c:213(my_print_stacktrace)[0x56192784f747]
sql/signal_handler.cc:222(handle_fatal_signal)[0x561926817120]
sigaction.c:0(__restore_rt)[0x7f8421883870]
sql/field.cc:2591(Field::set_default())[0x5619267979eb]
sql/item.cc:9489(Item_default_value::val_real())[0x5619268ace32]
sql/sql_type.cc:5087(Type_handler_real_result::Item_val_bool(Item*) const)[0x5619265e06b7]
sql/item_cmpfunc.cc:5439(Item_cond_or::val_int())[0x5619268d980b]
sql/item.h:958(Item::val_int_from_item(Item*))[0x5619269b0e04]
sql/item_func.cc:820(Item_func_hybrid_field_type::val_real_from_int_op())[0x5619269c5464]
sql/item_cmpfunc.cc:898(Arg_comparator::compare_real_fixed())[0x5619268d3d64]
sql/item_cmpfunc.cc:1764(Item_func_eq::val_int())[0x5619268e69eb]
sql/table.cc:6175(TABLE::verify_constraints(bool))[0x5619263e5199]
sql/table.cc:6126(TABLE_LIST::view_check_option(THD*, bool))[0x5619263e5a21]
sql/sql_insert.cc:1100(mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool, select_result*))[0x561925ffd5ea]
sql/sql_parse.cc:4565(mysql_execute_command(THD*, bool))[0x5619260afbb8]
sql/sql_parse.cc:8047(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x5619260bc5a1]
sql/sql_parse.cc:1898(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x5619260c260c]
sql/sql_parse.cc:1406(do_command(THD*, bool))[0x5619260c773d]
sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x561926482e57]
sql/sql_connect.cc:1312(handle_one_connection)[0x56192648333d]
perfschema/pfs.cc:2204(pfs_spawn_thread)[0x561926f13c2c]
pthread_create.c:0(start_thread)[0x7f8421879259]
:0(__GI___clone)[0x7f84214245e3]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x629000087238): INSERT v0 VALUES ( NULL , 0 )
 
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/0
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 10000 --datadir=/home/fuboat/mariadb-tmp/0'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f8421880808 in pthread_kill () from /usr/lib/libpthread.so.0
#1  0x000056192681706b in handle_fatal_signal (sig=<optimized out>) at /experiment/mariadb-server/sql/signal_handler.cc:344
#2  <signal handler called>
#3  0x00005619267979eb in Field::set_default (this=0x61d0000550b8) at /experiment/mariadb-server/sql/field.cc:2591
#4  0x00005619268ace32 in Item_default_value::val_real (this=0x6190000a3dd8) at /experiment/mariadb-server/sql/item.cc:9488
#5  0x00005619265e06b7 in Type_handler_real_result::Item_val_bool (this=<optimized out>, item=<optimized out>) at /experiment/mariadb-server/sql/sql_type.cc:5087
#6  0x00005619268d980b in Item_cond_or::val_int (this=0x61d000054968) at /experiment/mariadb-server/sql/item_cmpfunc.cc:5439
#7  0x00005619269b0e04 in Item::val_int_from_item (item=0x61d000054968, this=0x61d000054a58) at /experiment/mariadb-server/sql/item.h:957
#8  Item_func_ceiling::int_op (this=0x61d000054a58) at /experiment/mariadb-server/sql/item_func.cc:2347
#9  0x00005619269c5464 in Item_func_hybrid_field_type::val_real_from_int_op (this=0x61d000054a58) at /experiment/mariadb-server/sql/item_func.cc:819
#10 0x00005619268d3d64 in Arg_comparator::compare_real_fixed (this=0x61d000054c38) at /experiment/mariadb-server/sql/item_cmpfunc.cc:897
#11 0x00005619268e69eb in Arg_comparator::compare (this=<optimized out>) at /experiment/mariadb-server/sql/item_cmpfunc.h:103
#12 Item_func_eq::val_int (this=<optimized out>) at /experiment/mariadb-server/sql/item_cmpfunc.cc:1762
#13 0x00005619263e5199 in TABLE::verify_constraints (this=0x6190000a3298, ignore_failure=<optimized out>) at /experiment/mariadb-server/sql/table.cc:6175
#14 0x00005619263e5a21 in TABLE_LIST::view_check_option (this=this@entry=0x629000087348, thd=thd@entry=0x62b0000bd218, ignore_failure=<optimized out>) at /experiment/mariadb-server/sql/table.cc:6148
#15 0x0000561925ffd5ea in mysql_insert (thd=thd@entry=0x62b0000bd218, table_list=<optimized out>, fields=..., values_list=..., update_fields=..., update_values=..., duplic=<optimized out>, ignore=<optimized out>, result=<optimized out>) at /experiment/mariadb-server/sql/sql_insert.cc:1100
#16 0x00005619260afbb8 in mysql_execute_command (thd=0x62b0000bd218, is_called_from_prepared_stmt=<optimized out>) at /experiment/mariadb-server/sql/sql_parse.cc:4565
#17 0x00005619260bc5a1 in mysql_parse (thd=0x62b0000bd218, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /experiment/mariadb-server/sql/sql_parse.cc:8030
#18 0x00005619260c260c 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
#19 0x00005619260c773d in do_command (thd=0x62b0000bd218, blocking=blocking@entry=true) at /experiment/mariadb-server/sql/sql_parse.cc:1404
#20 0x0000561926482e57 in do_handle_one_connection (connect=<optimized out>, put_in_cache=<optimized out>) at /experiment/mariadb-server/sql/sql_connect.cc:1418
#21 0x000056192648333d in handle_one_connection (arg=arg@entry=0x6080000023b8) at /experiment/mariadb-server/sql/sql_connect.cc:1312
#22 0x0000561926f13c2c in pfs_spawn_thread (arg=0x617000005f18) at /experiment/mariadb-server/storage/perfschema/pfs.cc:2201
#23 0x00007f8421879259 in start_thread () from /usr/lib/libpthread.so.0
#24 0x00007f84214245e3 in clone () from /usr/lib/libc.so.6



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

Thanks! The same bug as MDEV-26061. I added the test there

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