Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26406

A SEGV in sql/sql_class.cc

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.7(EOL)
    • N/A
    • Data types
    • None
    • 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

    Description

      PoC:

      CREATE TABLE v0 ( v5 DATE , v4 TIME , v3 YEAR , v2 DATETIME , v1 TIMESTAMP ) SELECT 'x' , NOT TRUE IS NOT UNKNOWN ;
       SAVEPOINT v0 ;
       SELECT hex ( DEFAULT ( v1 ) ) FROM ( SELECT v1 FROM v0 GROUP BY v0 . v4 ) NEW ;
       SELECT * FROM v0 WHERE v4 IN ( SELECT EXP ( 16422771.000000 ) FROM v0 WHERE v2 IS NOT NULL ) IS FALSE ;
       SELECT * FROM v0 WHERE v3 = 'x' AND v2 LIKE 'x' ORDER BY v2 ;
       SHOW COLLATION LIKE 'x' ;
      

      Log:

       2021-08-16 14:41:38 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
      2021-08-16 14:41:38 0 [Note] InnoDB: Number of pools: 1
      2021-08-16 14:41:38 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2021-08-16 14:41:38 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
      2021-08-16 14:41:38 0 [Note] InnoDB: Using liburing
      2021-08-16 14:41:38 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
      2021-08-16 14:41:38 0 [Note] InnoDB: Completed initialization of buffer pool
      2021-08-16 14:41:38 0 [Note] InnoDB: 128 rollback segments are active.
      2021-08-16 14:41:38 0 [Note] InnoDB: Creating shared tablespace for temporary tables
      2021-08-16 14:41:38 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
      2021-08-16 14:41:38 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
      2021-08-16 14:41:38 0 [Note] InnoDB: 10.7.0 started; log sequence number 42161; transaction id 14
      2021-08-16 14:41:38 0 [Note] InnoDB: Loading buffer pool(s) from /home/fuboat/mariadb-tmp/mysql-default-data/ib_buffer_pool
      2021-08-16 14:41:38 0 [Note] Plugin 'FEEDBACK' is disabled.
      2021-08-16 14:41:38 0 [Note] InnoDB: Buffer pool(s) load completed at 210816 14:41:38
      2021-08-16 14:41:38 0 [Note] Server socket created on IP: '0.0.0.0'.
      2021-08-16 14:41:38 0 [Note] Server socket created on IP: '::'.
      2021-08-16 14:41:38 0 [Note] /usr/local/mysql/bin//mysqld: ready for connections.
      Version: '10.7.0-MariaDB'  socket: '/tmp/0.socket'  port: 3306  Source distribution
      2021-08-16 14:41:39 0 [Note] /usr/local/mysql/bin//mysqld (initiated by: root[root] @ localhost []): Normal shutdown
      2021-08-16 14:41:39 0 [Note] InnoDB: FTS optimize thread exiting.
      2021-08-16 14:41:39 0 [Note] InnoDB: Starting shutdown...
      2021-08-16 14:41:39 0 [Note] InnoDB: Dumping buffer pool(s) to /home/fuboat/mariadb-tmp/mysql-default-data/ib_buffer_pool
      2021-08-16 14:41:39 0 [Note] InnoDB: Buffer pool(s) dump completed at 210816 14:41:39
      2021-08-16 14:41:39 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
      2021-08-16 14:41:39 0 [Note] InnoDB: Shutdown completed; log sequence number 42173; transaction id 15
      2021-08-16 14:41:39 0 [Note] /usr/local/mysql/bin//mysqld: Shutdown complete
       
      2021-08-16 15:53:58 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
      2021-08-16 15:53:58 0 [Note] InnoDB: Number of pools: 1
      2021-08-16 15:53:58 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
      2021-08-16 15:53:58 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
      2021-08-16 15:53:58 0 [Note] InnoDB: Using liburing
      2021-08-16 15:53:58 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
      2021-08-16 15:53:58 0 [Note] InnoDB: Completed initialization of buffer pool
      2021-08-16 15:54:19 0 [Note] InnoDB: 128 rollback segments are active.
      2021-08-16 15:54:19 0 [Note] InnoDB: Creating shared tablespace for temporary tables
      2021-08-16 15:54:19 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
      2021-08-16 15:54:19 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
      2021-08-16 15:54:19 0 [Note] InnoDB: 10.7.0 started; log sequence number 42173; transaction id 14
      2021-08-16 15:54:19 0 [Note] InnoDB: Loading buffer pool(s) from /home/fuboat/mariadb-tmp/1/ib_buffer_pool
      2021-08-16 15:54:19 0 [Note] Plugin 'FEEDBACK' is disabled.
      2021-08-16 15:54:20 0 [Note] Server socket created on IP: '0.0.0.0'.
      2021-08-16 15:54:20 0 [Note] Server socket created on IP: '::'.
      2021-08-16 15:54:21 0 [Note] InnoDB: Buffer pool(s) load completed at 210816 15:54:21
      2021-08-16 15:54:22 0 [Note] /usr/local/mysql/bin//mysqld: ready for connections.
      Version: '10.7.0-MariaDB'  socket: '/tmp/1.socket'  port: 10001  Source distribution
      210816 15:54:24 [ERROR] mysqld got signal 11 ;
      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.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 = 0x7f418124e850 thread_stack 0x5fc00
      sanitizer_common/sanitizer_common_interceptors.inc:4203(__interceptor_backtrace.part.0)[0x7f41a0afac3e]
      mysys/stacktrace.c:213(my_print_stacktrace)[0x55974216a747]
      sql/signal_handler.cc:222(handle_fatal_signal)[0x559741132120]
      sigaction.c:0(__restore_rt)[0x7f41a04e4870]
      sql/sql_class.cc:3832(Query_arena::set_query_arena(Query_arena*))[0x559740899973]
      sql/field.cc:2591(Field::set_default())[0x5597410b299e]
      sql/item.cc:9483(Item_default_value::val_str(String*))[0x5597411c7e03]
      sql/item_strfunc.cc:3769(Item_func_hex::val_str_ascii_from_val_str(String*))[0x5597413ca802]
      sql/item_strfunc.cc:99(Item_func::val_str_from_val_str_ascii(String*, String*))[0x5597413c4ec0]
      sql/sql_type.cc:7455(Type_handler::Item_send_str(Item*, Protocol*, st_value*) const)[0x559740f3fc23]
      sql/protocol.cc:1327(Protocol::send_result_set_row(List<Item>*))[0x55974074dccf]
      sql/sql_class.cc:3072(select_send::send_data(List<Item>&))[0x5597408a32ba]
      sql/sql_select.cc:22285(end_send(JOIN*, st_join_table*, bool))[0x559740b17983]
      sql/sql_select.cc:21279(evaluate_join_record(JOIN*, st_join_table*, int))[0x559740a84094]
      sql/sql_select.cc:21069(sub_select(JOIN*, st_join_table*, bool))[0x559740ac4fcc]
      sql/sql_select.cc:20602(JOIN::exec_inner())[0x559740b69b8d]
      sql/sql_select.cc:4514(JOIN::exec())[0x559740b6b593]
      sql/sql_select.cc:4993(mysql_select(THD*, TABLE_LIST*, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x559740b63b5b]
      sql/sql_select.cc:545(handle_select(THD*, LEX*, select_result*, unsigned long))[0x559740b65655]
      sql/sql_parse.cc:6256(execute_sqlcom_select(THD*, TABLE_LIST*))[0x5597409a8d7d]
      sql/sql_parse.cc:3946(mysql_execute_command(THD*, bool))[0x5597409d2421]
      sql/sql_parse.cc:8047(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x5597409d75a1]
      sql/sql_parse.cc:1898(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x5597409dd60c]
      sql/sql_parse.cc:1406(do_command(THD*, bool))[0x5597409e273d]
      sql/sql_connect.cc:1418(do_handle_one_connection(CONNECT*, bool))[0x559740d9de57]
      sql/sql_connect.cc:1312(handle_one_connection)[0x559740d9e33d]
      perfschema/pfs.cc:2204(pfs_spawn_thread)[0x55974182ec2c]
      pthread_create.c:0(start_thread)[0x7f41a04da259]
      :0(__GI___clone)[0x7f41a00855e3]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x629000087238): SELECT hex ( DEFAULT ( v1 ) ) FROM ( SELECT v1 FROM v0 GROUP BY v0 . v4 ) NEW
       
      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/1
      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
      
      

      Coredump:

      GNU gdb (GDB) 10.2
      Copyright (C) 2021 Free Software Foundation, Inc.
      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
      Type "show copying" and "show warranty" for details.
      This GDB was configured as "x86_64-pc-linux-gnu".
      Type "show configuration" for configuration details.
      For bug reporting instructions, please see:
      <https://www.gnu.org/software/gdb/bugs/>.
      Find the GDB manual and other documentation resources online at:
          <http://www.gnu.org/software/gdb/documentation/>.
       
      For help, type "help".
      Type "apropos word" to search for commands related to "word"...
      Reading symbols from /usr/local/mysql/bin//mysqld...
      [New LWP 3402272]
      [New LWP 3390160]
      [New LWP 3390156]
      [New LWP 3390161]
      [New LWP 3390159]
      [New LWP 3400198]
      [New LWP 3400197]
      [New LWP 3400232]
      [New LWP 3400234]
      [New LWP 3402269]
      [New LWP 3390146]
      [New LWP 3400230]
      [New LWP 3400228]
      [New LWP 3400229]
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/usr/lib/libthread_db.so.1".
      Core was generated by `/usr/local/mysql/bin//mysqld --port 10001 --datadir=/home/fuboat/mariadb-tmp/1'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00007f41a04e1808 in pthread_kill () from /usr/lib/libpthread.so.0
      [Current thread is 1 (Thread 0x7f418124f240 (LWP 3402272))]
      (gdb) (gdb) #0  0x00007f41a04e1808 in pthread_kill () from /usr/lib/libpthread.so.0
      #1  0x000055974113206b in handle_fatal_signal (sig=<optimized out>) at /experiment/mariadb-server/sql/signal_handler.cc:344
      #2  <signal handler called>
      #3  0x0000559740899973 in Query_arena::set_query_arena (this=0x62b0000bd230, set=0x0) at /experiment/mariadb-server/sql/sql_class.cc:3832
      #4  0x000055974089a15a in THD::set_n_backup_active_arena (this=<optimized out>, set=<optimized out>, backup=backup@entry=0x7f418124b2a0) at /experiment/mariadb-server/sql/sql_class.cc:3920
      #5  0x00005597410b299e in Field::set_default (this=0x6290000a03c0) at /experiment/mariadb-server/sql/field.cc:2590
      #6  0x00005597411c7e03 in Item_default_value::val_str (this=0x629000087908, str=0x629000087b50) at /experiment/mariadb-server/sql/item.cc:9482
      #7  0x00005597413ca802 in Item_func_hex::val_str_ascii_from_val_str (this=0x629000087a88, str=0x7f418124b550) at /experiment/mariadb-server/sql/item_strfunc.cc:3767
      #8  0x00005597413c4ec0 in Item_func::val_str_from_val_str_ascii (this=0x629000087a88, str=0x7f418124b550, ascii_buffer=<optimized out>) at /experiment/mariadb-server/sql/item_strfunc.cc:98
      #9  0x0000559740f3fc23 in Type_handler::Item_send_str (this=<optimized out>, item=<optimized out>, protocol=0x62b0000bd778, buf=<optimized out>) at /experiment/mariadb-server/sql/sql_type.cc:7455
      #10 0x000055974074dccf in Protocol::send_result_set_row (this=this@entry=0x62b0000bd778, row_items=row_items@entry=0x6290000875e0) at /experiment/mariadb-server/sql/protocol.cc:1327
      #11 0x00005597408a32ba in select_send::send_data (this=0x62900008a378, items=...) at /experiment/mariadb-server/sql/sql_class.cc:3072
      #12 0x0000559740b17983 in select_result_sink::send_data_with_check (u=<optimized out>, sent=<optimized out>, items=..., this=<optimized out>) at /experiment/mariadb-server/sql/sql_class.h:5633
      #13 select_result_sink::send_data_with_check (sent=<optimized out>, u=<optimized out>, items=..., this=<optimized out>) at /experiment/mariadb-server/sql/sql_class.h:5623
      #14 end_send (join=0x62900008a3a8, join_tab=0x6290000a35a8, end_of_records=<optimized out>) at /experiment/mariadb-server/sql/sql_select.cc:22285
      #15 0x0000559740a84094 in evaluate_join_record (join=0x62900008a3a8, join_tab=0x6290000a31f8, error=<optimized out>) at /experiment/mariadb-server/sql/sql_select.cc:21278
      #16 0x0000559740ac4fcc in sub_select (join=0x62900008a3a8, join_tab=0x6290000a31f8, end_of_records=false) at /experiment/mariadb-server/sql/sql_select.cc:21055
      #17 0x0000559740b69b8d in do_select (procedure=0x0, join=0x62900008a3a8) at /experiment/mariadb-server/sql/sql_select.cc:20602
      #18 JOIN::exec_inner (this=0x62900008a3a8) at /experiment/mariadb-server/sql/sql_select.cc:4735
      #19 0x0000559740b6b593 in JOIN::exec (this=this@entry=0x62900008a3a8) at /experiment/mariadb-server/sql/sql_select.cc:4513
      #20 0x0000559740b63b5b in mysql_select (thd=0x62b0000bd218, tables=<optimized out>, fields=..., conds=<optimized out>, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x62900008a378, unit=0x62b0000c13c0, select_lex=0x629000087340)
          at /experiment/mariadb-server/sql/sql_select.cc:4991
      #21 0x0000559740b65655 in handle_select (thd=thd@entry=0x62b0000bd218, lex=lex@entry=0x62b0000c12f8, result=result@entry=0x62900008a378, setup_tables_done_option=setup_tables_done_option@entry=0) at /experiment/mariadb-server/sql/sql_select.cc:545
      #22 0x00005597409a8d7d in execute_sqlcom_select (thd=0x62b0000bd218, all_tables=<optimized out>) at /experiment/mariadb-server/sql/sql_parse.cc:6256
      #23 0x00005597409d2421 in mysql_execute_command (thd=0x62b0000bd218, is_called_from_prepared_stmt=<optimized out>) at /experiment/mariadb-server/sql/sql_parse.cc:3946
      #24 0x00005597409d75a1 in mysql_parse (thd=0x62b0000bd218, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /experiment/mariadb-server/sql/sql_parse.cc:8030
      #25 0x00005597409dd60c 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
      #26 0x00005597409e273d in do_command (thd=0x62b0000bd218, blocking=blocking@entry=true) at /experiment/mariadb-server/sql/sql_parse.cc:1404
      #27 0x0000559740d9de57 in do_handle_one_connection (connect=<optimized out>, put_in_cache=<optimized out>) at /experiment/mariadb-server/sql/sql_connect.cc:1418
      #28 0x0000559740d9e33d in handle_one_connection (arg=arg@entry=0x6080000023b8) at /experiment/mariadb-server/sql/sql_connect.cc:1312
      #29 0x000055974182ec2c in pfs_spawn_thread (arg=0x617000005f18) at /experiment/mariadb-server/storage/perfschema/pfs.cc:2201
      #30 0x00007f41a04da259 in start_thread () from /usr/lib/libpthread.so.0
      #31 0x00007f41a00855e3 in clone () from /usr/lib/libc.so.6
      (gdb) quit
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Zhiyong Zhiyong Wu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.