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

LP:957409 - Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Hi,

      I've just hit a bug with MariaDB 5.3.5-ga. The stack trace is the following :

      Mar 15 16:57:46 mysql mysqld: 2d2d2d d:2d:2d [ERROR] mysqld got signal 11 ;
      Mar 15 16:57:46 mysql mysqld: This could be because you hit a bug. It is also possible that this binary
      Mar 15 16:57:46 mysql mysqld: or one of the libraries it was linked against is corrupt, improperly built,
      Mar 15 16:57:46 mysql mysqld: or misconfigured. This error can also be caused by malfunctioning hardware.
      Mar 15 16:57:46 mysql mysqld:
      Mar 15 16:57:46 mysql mysqld: To report this bug, see http://kb.askmonty.org/en/reporting-bugs
      Mar 15 16:57:46 mysql mysqld:
      Mar 15 16:57:46 mysql mysqld: We will try our best to scrape up some info that will hopefully help
      Mar 15 16:57:46 mysql mysqld: diagnose the problem, but since we have already crashed,
      Mar 15 16:57:46 mysql mysqld: something is definitely wrong and this may fail.
      Mar 15 16:57:46 mysql mysqld:
      Mar 15 16:57:46 mysql mysqld: Server version: 5.3.5-MariaDB-ga
      Mar 15 16:57:46 mysql mysqld: key_buffer_size=1073741824
      Mar 15 16:57:46 mysql mysqld: read_buffer_size=4194304
      Mar 15 16:57:46 mysql mysqld: max_used_connections=24
      Mar 15 16:57:46 mysql mysqld: max_threads=201
      Mar 15 16:57:46 mysql mysqld: thread_count=19
      Mar 15 16:57:46 mysql mysqld: connection_count=19
      Mar 15 16:57:46 mysql mysqld: It is possible that mysqld could use up to
      Mar 15 16:57:46 mysql mysqld: key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 2697769 K bytes of memory
      Mar 15 16:57:46 mysql mysqld: Hope that's ok; if not, decrease some variables in the equation.
      Mar 15 16:57:46 mysql mysqld:
      Mar 15 16:57:46 mysql mysqld: Thread pointer: 0xda56fe0
      Mar 15 16:57:46 mysql mysqld: Attempting backtrace. You can use the following information to find out
      Mar 15 16:57:46 mysql mysqld: where mysqld died. If you see no messages after this, something went
      Mar 15 16:57:46 mysql mysqld: terribly wrong...

      Mar 15 16:57:46 mysql mysqld: stack_bottom = 7fc0f7ccae98 thread_stack 0x3c000
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(my_print_stacktrace+0x2e) [0xa2ab6e]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(handle_fatal_signal+0x3f9) [0x761e89]
      Mar 15 16:57:46 mysql mysqld: /lib/libpthread.so.0(+0xef60) [0x7fc29fe9ef60]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(create_internal_tmp_table(st_table*, st_key*, st_maria_columndef*, st_maria_columndef**, unsigned long long)+0x218) [0x6afc58]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(mysql_derived_create(THD*, st_lex*, TABLE_LIST*)+0xc4) [0x7ad5a4]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(mysql_handle_single_derived(st_lex*, TABLE_LIST*, unsigned int)+0xb8) [0x7ae5e8]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(st_join_table::preread_init()+0xa1) [0x6aaf91]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(sub_select(JOIN*, st_join_table*, bool)+0x496) [0x6bcd16]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld() [0x6bce63]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(JOIN::exec()+0x852) [0x6cf6d2]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(mysql_select(THD*, Item**, 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*)+0x185) [0x6d17b5]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(handle_select(THD*, st_lex*, select_result*, unsigned long)+0x16f) [0x6d21ef]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld() [0x6480ce]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(mysql_execute_command(THD*)+0x39c8) [0x64dc38]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(mysql_parse(THD*, char*, unsigned int, char const**)+0x299) [0x650a19]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0xa72) [0x6518e2]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(do_command(THD*)+0x101) [0x652431]
      Mar 15 16:57:46 mysql mysqld: ./bin/mysqld(handle_one_connection+0xfd) [0x64391d]
      Mar 15 16:57:46 mysql mysqld: /lib/libpthread.so.0(+0x68ba) [0x7fc29fe968ba]
      Mar 15 16:57:46 mysql mysqld: /lib/libc.so.6(clone+0x6d) [0x7fc29f46002d]

      The query :

      SELECT tmp.*, m.photo , m.login member_name, m.sexe, pv.name plateform_name FROM ((SELECT mp.product_id id, mp.date_review, mp.status, mp.plateform_id, mp.id review_id, mp.member_id, mp.note, mp.nb_comment, mp.review_all, mp.review_like, mp.selection, mp.conso_future, mpd.review, mpd.review_status, mpd.title_review from sc_member_product_light mp LEFT JOIN sc_member_product_detail mpd ON mpd.member_id = mp.member_id AND mpd.product_id = mp.product_id where mp.product_id = 366123681178224 AND is_review = 1 AND mp.status = 0 AND mp.note > 5 order by review_like DESC, review_all ASC, note DESC limit 1) UNION (SELECT mp.product_id id, mp.date_review, mp.status, mp.plateform_id, mp.id review_id, mp.member_id, mp.note, mp.nb_comment, mp.review_all, mp.review_like, mp.selection, mp.conso_future, mpd.review, mpd.review_status, mpd.title_review from sc_member_product_light mp LEFT JOIN sc_member_product_detail mpd ON mpd.member_id = mp.member_id AND mpd.product_id = mp.product_id where mp.product_id = 366123681178224 AND is_review = 1 AND mp.status = 0 AND mp.note <= 5 order by review_like DESC, review_all ASC, note ASC limit 1)) as tmp JOIN sc_member m ON m.id = tmp.member_id LEFT JOIN sc_param_values pv ON pv.id = tmp.plateform_id

      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=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

      and execution plan

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

      id select_type table type possible_keys key key_len ref rows Extra

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

      1 PRIMARY <derived2> ALL key0 NULL NULL NULL 2  
      1 PRIMARY pv eq_ref PRIMARY PRIMARY 4 tmp.plateform_id 1  
      1 PRIMARY m eq_ref PRIMARY,member_photo PRIMARY 4 tmp.member_id 1  
      2 DERIVED mp range note,is_review,product_2,member_2,product_3,status product_3 12 NULL 201 Using index condition; Using where; Using filesort
      2 DERIVED mpd eq_ref unique_product_member,product,member,member_2 unique_product_member 12 sc.mp.member_id,const 1 Using where
      3 UNION mp range note,is_review,product_2,member_2,product_3,status product_3 12 NULL 129 Using index condition; Using where; Using filesort
      3 UNION mpd eq_ref unique_product_member,product,member,member_2 unique_product_member 12 sc.mp.member_id,const 1 Using where
      NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL  

      -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      8 rows in set (0,24 sec)

      The crash is quite random. The query could finish successfully or just issue a
      ERROR 5 (HY000): Out of memory (Needed 1730537048 bytes)

      Before trying to dig more and try to make a reproducable testcase, is there any specific parameters I could control which could explain the reported memory allocation ?

      Thanks and regards,
      Jocelyn Fournier

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            elenst Elena Stepanova added a comment -

            Re: Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view

            Show
            elenst Elena Stepanova added a comment - Re: Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view
            Hide
            igor Igor Babaev added a comment -

            Re: Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view
            I confirm that the bug is reproducible with 5.3 rev.3458

            Show
            igor Igor Babaev added a comment - Re: Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view I confirm that the bug is reproducible with 5.3 rev.3458
            Hide
            igor Igor Babaev added a comment -

            Re: Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view
            I checked that this was another manifestation of bug #953649 fixed in rev.3459.

            Show
            igor Igor Babaev added a comment - Re: Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view I checked that this was another manifestation of bug #953649 fixed in rev.3459.
            Hide
            elenst Elena Stepanova added a comment -

            Re: Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view
            Fix for bug #953649 was released in 5.3.6

            Show
            elenst Elena Stepanova added a comment - Re: Crash in create_internal_tmp_table or OOM or internal error: 'Using too big key for internal temp tables' with derived_with_keys=on, FROM subquery or view Fix for bug #953649 was released in 5.3.6
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 957409

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 957409

              People

              • Assignee:
                igor Igor Babaev
                Reporter:
                jocelynfournier jocelyn fournier
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: