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

Core dump in mysqld when executing SELECT statement

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2, 10.3, 10.2.13, 10.3.6
    • Fix Version/s: 10.2.16, 10.3.8
    • Component/s: Optimizer
    • Labels:
    • Environment:
      Ubuntu 16.04 LTS

      Description

      I apologize in advance for my lack of experience in reporting MariaDB issues; I'll do my best.

      I'm not even sure where to start troubleshooting this, but I have a PHP application that queries MariaDB, and for whatever reason, this particular query is causing a core-dump in mysqld.

      Curiously, the very same query, when executed directly against mysqld (i.e., without PHP involved) doesn't seem to cause the crash. I am hoping that somebody here may be able to articulate the reason for this observation, or at least point me towards the actual culprit. (If providing all of my PHP information would be prudent or helpful, just let me know.)

      Similarly, if table dumps would be helpful, I am willing to provide them, but they are sensitive in nature and contain confidential information.

      I was using MariaDB 10.2.13 when I noticed the issue, but am able to reproduce it on 10.3.6.

      I built MariaDB 10.3.6 with debugging enabled and captured a core-dump, which is massive for whatever reason (816MB), so I can't upload it here (the limit looks to be 10MB). I have instead uploaded the core dump and corresponding mysqld binary to ftp.askmonty.org/private, as "MDEV-16148-core" and "MDEV-16148-mysqld", respectively.

      The entry in error.log is as follows:

      180511 14:36:20 [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.3.6-MariaDB-1:10.3.6+maria~xenial-log
      key_buffer_size=402653184
      read_buffer_size=2097152
      max_used_connections=3
      max_threads=102
      thread_count=10
      It is possible that mysqld could use up to
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 813259 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7f8a6c0009a8
      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 = 0x7f8ac440ccf8 thread_stack 0x49000
      /usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x555bbc26097e]
      mysys/stacktrace.c:270(my_print_stacktrace)[0x555bbbd0fd67]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f8b088c7390]
      /usr/sbin/mysqld(_Z30setup_sj_materialization_part2P13st_join_table+0x2ab)[0x555bbbc4769b]
      sql/opt_subselect.cc:3955(setup_sj_materialization_part2(st_join_table*))[0x555bbba51f73]
      sql/sql_select.cc:11916(make_join_readinfo(JOIN*, unsigned long long, unsigned int))[0x555bbbb8a050]
      sql/sql_select.cc:2341(JOIN::optimize_stage2())[0x555bbbb8c01f]
      sql/sql_select.cc:1511(JOIN::optimize_inner())[0x555bbbb8c207]
      sql/sql_select.cc:1433(JOIN::optimize())[0x555bbbb8e0d0]
      sql/sql_select.cc:4138(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x555bbbb8e208]
      sql/sql_select.cc:382(handle_select(THD*, LEX*, select_result*, unsigned long))[0x555bbba516eb]
      sql/sql_parse.cc:6541(execute_sqlcom_select(THD*, TABLE_LIST*) [clone .constprop.235])[0x555bbbb3d2bd]
      sql/sql_parse.cc:3768(mysql_execute_command(THD*))[0x555bbbb5387d]
      sql/sql_prepare.cc:4740(Prepared_statement::execute(String*, bool))[0x555bbbb53f34]
      sql/sql_prepare.cc:4170(Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*))[0x555bbbb54a08]
      sql/sql_prepare.cc:3170(mysql_stmt_execute_common(THD*, unsigned long, unsigned char*, unsigned char*, unsigned long, bool, bool) [clone .constprop.202])[0x555bbbb54b45]
      sql/sql_prepare.cc:3069(mysqld_stmt_execute(THD*, char*, unsigned int))[0x555bbbb416ad]
      sql/sql_parse.cc:1788(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x555bbbb428e7]
      sql/sql_parse.cc:1393(do_command(THD*))[0x555bbbc1083a]
      sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x555bbbc109ad]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f8b088bd6ba]
      /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f8b07f6841d]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f8a6c013770): select count(*) as aggregate from `onsite_assessment`.`mmic_focuses` where `onsite_consult_id` = 58 and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '12' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '7' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '9' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '11' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '4' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '10' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '1' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '2' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and exists (select * from `onsite_assessment`.`mmic_sub_focuses` where `onsite_assessment`.`mmic_focuses`.`id` = `onsite_assessment`.`mmic_sub_focuses`.`focus_id` and `id` != '3' and `onsite_assessment`.`mmic_sub_focuses`.`deleted_at` is null) and `onsite_assessment`.`mmic_focuses`.`deleted_at` is null
      Connection ID (thread ID): 10
      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,split_materialized=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.
      Writing a core file at /var/lib/mysql/
      

      And my configuration:

      mysqld --print-defaults
      mysqld would have been started with the following arguments:
      --stack-trace --core-file --disable-gdb --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306 --basedir=/usr --datadir=/var/lib/mysql --tmpdir=/tmp --lc_messages_dir=/usr/share/mysql --lc_messages=en_US --skip-external-locking --bind-address=0.0.0.0 --max_connections=100 --connect_timeout=5 --wait_timeout=600 --max_allowed_packet=16M --thread_cache_size=128 --sort_buffer_size=4M --bulk_insert_buffer_size=16M --tmp_table_size=32M --max_heap_table_size=32M --myisam_recover_options=BACKUP --key_buffer_size=128M --table_open_cache=400 --myisam_sort_buffer_size=512M --concurrent_insert=2 --read_buffer_size=2M --read_rnd_buffer_size=1M --query_cache_limit=128K --query_cache_size=64M --log_warnings=2 --slow_query_log_file=/var/log/mysql/mariadb-slow.log --long_query_time=10 --log_slow_verbosity=query_plan --log_bin=/var/log/mysql/mariadb-bin --log_bin_index=/var/log/mysql/mariadb-bin.index --expire_logs_days=10 --max_binlog_size=100M --default_storage_engine=InnoDB --innodb_buffer_pool_size=256M --innodb_log_buffer_size=8M --innodb_file_per_table=1 --innodb_open_files=400 --innodb_io_capacity=400 --innodb_flush_method=O_DIRECT --default_storage_engine=InnoDB --skip-character-set-client-handshake --collation_server=utf8_unicode_ci --character_set_server=utf8 --long_query_time=10 --log-queries-not-using-indexes=OFF --skip-external-locking --key_buffer_size=384M --max_allowed_packet=128M --table_open_cache=512 --sort_buffer_size=2M --read_buffer_size=2M --read_rnd_buffer_size=8M --myisam_sort_buffer_size=64M --thread_cache_size=8 --query_cache_size=32M --innodb_data_home_dir=/var/lib/mysql --innodb_data_file_path=ibdata1:10M:autoextend --innodb_log_group_home_dir=/var/lib/mysql --innodb_buffer_pool_size=384M --innodb_log_file_size=100M --innodb_log_buffer_size=8M --innodb_flush_log_at_trx_commit=1 --innodb_lock_wait_timeout=50 --general-log --general-log-file=/var/log/mysql/queries.log --log-output=file --log-error=/var/log/mysql/error.log
      

      I am of course happy to provide any other information that would be useful.

        Attachments

          Activity

            People

            Assignee:
            varun Varun Gupta
            Reporter:
            cbj4074 Ben Johnson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: