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

Fatal memory leak in MariaDB 5.5.30 - any workaround?

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Environment:
      Gentoo Linux, TokuDB with MariaDB 5.5.30

      Description

      Hi,

      we are trying to test latest TokuDB with our project (TokuDB 7.1 with MariaDB 5.5.30)

      TokuDB works fine, but we found one fatal memory leak. It not depends on MySQL engine (tested with TokuDB, InnoDB, MYISAM).

      Below is link to TokuDB issue with example and steps to reproduce.
      https://groups.google.com/forum/#!topic/tokudb-user/hkYkLIjCiVs

      After consultations with TokuDB support, it looks like a bug in MariaDB 5.5.30. But, this bug isn't in MariaDB 5.5.33a. By info from TokuDB, latest MariaDB will be used at end of year - too late for us.

      I see, that MariaDB has own TokuDB implementation, but it's not available for Gentoo Linux.

      Question 1: is possible to combine latest MariaDB (without this bug) with TokuDB on Gentoo Linux?

      Question 2: do you know about this memory leak? Maybe is there some simple applicable workaround/patch?

      Thank you.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            jan.reges Ján Regeš added a comment -

            Hi Elena,

            Unfortunatelly, problem still exists

            1) I use latest Gentoo with kernel 3.11.6 and with all packages in latest versions (GLIBC 2.17)
            2) I installed from binaries "mariadb-5.5.33a-linux-x86_64.tar.gz (requires GLIBC_2.14+)"
            3) I put your ha_tokudb.so from ftp://ftp.askmonty.org/public into plugins and set "plugin-load = ha_tokudb" into my.cnf
            4) Now, sample database with innodb works file - also with view
            5) But, when i try to create any TokuDB table, or change existing table engine to TokuDB, mysql crashed.

            Details below. Thank you.

            Now, i will trying to build MariaDB also from source "mariadb-5.5.33a.tar.gz".

            EXAMPLE SQL:
            --------------------

            [SQL]CREATE TABLE `balicek2` (
            `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
            `apl_kod` varchar(30) NOT NULL,
            `nazev` varchar(100) NOT NULL,
            `pristupny_partnerum` char(1) DEFAULT 'N',
            PRIMARY KEY (`id`),
            UNIQUE KEY `UK_apl_kod` (`apl_kod`) USING BTREE
            ) ENGINE=TokuDB DEFAULT CHARSET=utf8 COMPRESSION=TOKUDB_LZMA;
            [Err] 2003 - Can't connect to MySQL server on '192.168.2.9' (10038)

            LOG:
            -------

            131024 15:08:50 [Note] /opt/tokudb/bin/mysqld: ready for connections.
            Version: '5.5.33a-MariaDB-log' socket: '/opt/tokudb/run/mysqld-tokudb.sock' port: 3307 MariaDB Server
            131024 15:08:50 [Note] Event Scheduler: scheduler thread started with id 1
            131024 15:13:46 [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 http://kb.askmonty.org/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: 5.5.33a-MariaDB-log
            key_buffer_size=536870912
            read_buffer_size=1048576
            max_used_connections=8
            max_threads=102
            thread_count=8
            It is possible that mysqld could use up to
            key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1048331 K bytes of memory
            Hope that's ok; if not, decrease some variables in the equation.

            Thread pointer: 0x0x7ffa87efe000
            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 = 0x7ffa77556e20 thread_stack 0x80000
            mysys/stacktrace.c:247(my_print_stacktrace)[0xad495b]
            sql/signal_handler.cc:153(handle_fatal_signal)[0x6db194]
            :0()[0x7ffbe29d9170]
            :0()[0x7ffbdfc6d715]
            sql/table.cc:1819(open_binary_frm)[0x63b01d]
            sql/handler.cc:4055(ha_create_table(THD*, char const*, char const*, char const*, st_ha_create_information*, bool))[0x6e2992]
            sql/unireg.cc:500(rea_create_table(THD*, char const*, char const*, char const*, st_ha_create_information*, List<Create_field>&, unsigned int, st_key*, handler*))[0x64b9f7]
            sql/sql_table.cc:4483(mysql_create_table_no_lock)[0x61499d]
            sql/sql_table.cc:6738(mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool, bool))[0x61b659]
            sql/sql_alter.cc:106(Alter_table_statement::execute(THD*))[0x814ff2]
            sql/sql_parse.cc:4485(mysql_execute_command(THD*))[0x59efb8]
            sql/sql_parse.cc:5769(mysql_parse)[0x5a51e4]
            sql/sql_parse.cc:5720(mysql_parse)[0x5a781f]
            sql/sql_connect.cc:1266(do_handle_one_connection(THD*))[0x6608b3]
            sql/sql_connect.cc:1183(handle_one_connection)[0x6609fc]
            :0()[0x7ffbe29d1bd5]
            :0()[0x7ffbe2108d7d]

            Trying to get some variables.
            Some pointers may be invalid and cause the dump to abort.
            Query (0x7ffa58c23018): is an invalid pointer
            Connection ID (thread ID): 11
            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_p
            ushdown=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_s
            ize=off,table_elimination=on,extended_keys=off

            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.
            131024 15:13:46 mysqld_safe Number of processes running now: 0
            131024 15:13:46 mysqld_safe mysqld restarted

            TOKUDB VARIABLES:
            ----------------------------

            tokudb_analyze_time 60
            tokudb_block_size 4194304
            tokudb_cache_size 16863524864
            tokudb_checkpoint_lock OFF
            tokudb_checkpoint_on_flush_logs OFF
            tokudb_checkpointing_period 60
            tokudb_cleaner_iterations 5
            tokudb_cleaner_period 1
            tokudb_commit_sync ON
            tokudb_create_index_online ON
            tokudb_data_dir
            tokudb_debug 0
            tokudb_directio OFF
            tokudb_disable_hot_alter OFF
            tokudb_disable_prefetching OFF
            tokudb_disable_slow_alter OFF
            tokudb_fs_reserve_percent 5
            tokudb_fsync_log_period 0
            tokudb_gdb_on_fatal ON
            tokudb_gdb_path /usr/bin/gdb
            tokudb_init_flags 11403457
            tokudb_load_save_space OFF
            tokudb_lock_timeout 4000
            tokudb_log_client_errors OFF
            tokudb_log_dir
            tokudb_max_lock_memory 2107940608
            tokudb_pk_insert_mode 1
            tokudb_prelock_empty ON
            tokudb_read_block_size 131072
            tokudb_read_buf_size 131072
            tokudb_read_status_frequency 10000
            tokudb_row_format tokudb_default
            tokudb_tmp_dir
            tokudb_version 7.0.4
            tokudb_write_status_frequency 1000

            Show
            jan.reges Ján Regeš added a comment - Hi Elena, Unfortunatelly, problem still exists 1) I use latest Gentoo with kernel 3.11.6 and with all packages in latest versions (GLIBC 2.17) 2) I installed from binaries "mariadb-5.5.33a-linux-x86_64.tar.gz (requires GLIBC_2.14+)" 3) I put your ha_tokudb.so from ftp://ftp.askmonty.org/public into plugins and set "plugin-load = ha_tokudb" into my.cnf 4) Now, sample database with innodb works file - also with view 5) But, when i try to create any TokuDB table, or change existing table engine to TokuDB, mysql crashed. Details below. Thank you. Now, i will trying to build MariaDB also from source "mariadb-5.5.33a.tar.gz". EXAMPLE SQL: -------------------- [SQL] CREATE TABLE `balicek2` ( `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `apl_kod` varchar(30) NOT NULL, `nazev` varchar(100) NOT NULL, `pristupny_partnerum` char(1) DEFAULT 'N', PRIMARY KEY (`id`), UNIQUE KEY `UK_apl_kod` (`apl_kod`) USING BTREE ) ENGINE=TokuDB DEFAULT CHARSET=utf8 COMPRESSION=TOKUDB_LZMA; [Err] 2003 - Can't connect to MySQL server on '192.168.2.9' (10038) LOG: ------- 131024 15:08:50 [Note] /opt/tokudb/bin/mysqld: ready for connections. Version: '5.5.33a-MariaDB-log' socket: '/opt/tokudb/run/mysqld-tokudb.sock' port: 3307 MariaDB Server 131024 15:08:50 [Note] Event Scheduler: scheduler thread started with id 1 131024 15:13:46 [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 http://kb.askmonty.org/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: 5.5.33a-MariaDB-log key_buffer_size=536870912 read_buffer_size=1048576 max_used_connections=8 max_threads=102 thread_count=8 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1048331 K bytes of memory Hope that's ok; if not, decrease some variables in the equation. Thread pointer: 0x0x7ffa87efe000 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 = 0x7ffa77556e20 thread_stack 0x80000 mysys/stacktrace.c:247(my_print_stacktrace) [0xad495b] sql/signal_handler.cc:153(handle_fatal_signal) [0x6db194] :0( ) [0x7ffbe29d9170] :0( ) [0x7ffbdfc6d715] sql/table.cc:1819(open_binary_frm) [0x63b01d] sql/handler.cc:4055(ha_create_table(THD*, char const*, char const*, char const*, st_ha_create_information*, bool)) [0x6e2992] sql/unireg.cc:500(rea_create_table(THD*, char const*, char const*, char const*, st_ha_create_information*, List<Create_field>&, unsigned int, st_key*, handler*)) [0x64b9f7] sql/sql_table.cc:4483(mysql_create_table_no_lock) [0x61499d] sql/sql_table.cc:6738(mysql_alter_table(THD*, char*, char*, st_ha_create_information*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool, bool)) [0x61b659] sql/sql_alter.cc:106(Alter_table_statement::execute(THD*)) [0x814ff2] sql/sql_parse.cc:4485(mysql_execute_command(THD*)) [0x59efb8] sql/sql_parse.cc:5769(mysql_parse) [0x5a51e4] sql/sql_parse.cc:5720(mysql_parse) [0x5a781f] sql/sql_connect.cc:1266(do_handle_one_connection(THD*)) [0x6608b3] sql/sql_connect.cc:1183(handle_one_connection) [0x6609fc] :0( ) [0x7ffbe29d1bd5] :0( ) [0x7ffbe2108d7d] Trying to get some variables. Some pointers may be invalid and cause the dump to abort. Query (0x7ffa58c23018): is an invalid pointer Connection ID (thread ID): 11 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_p ushdown=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_s ize=off,table_elimination=on,extended_keys=off 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. 131024 15:13:46 mysqld_safe Number of processes running now: 0 131024 15:13:46 mysqld_safe mysqld restarted TOKUDB VARIABLES: ---------------------------- tokudb_analyze_time 60 tokudb_block_size 4194304 tokudb_cache_size 16863524864 tokudb_checkpoint_lock OFF tokudb_checkpoint_on_flush_logs OFF tokudb_checkpointing_period 60 tokudb_cleaner_iterations 5 tokudb_cleaner_period 1 tokudb_commit_sync ON tokudb_create_index_online ON tokudb_data_dir tokudb_debug 0 tokudb_directio OFF tokudb_disable_hot_alter OFF tokudb_disable_prefetching OFF tokudb_disable_slow_alter OFF tokudb_fs_reserve_percent 5 tokudb_fsync_log_period 0 tokudb_gdb_on_fatal ON tokudb_gdb_path /usr/bin/gdb tokudb_init_flags 11403457 tokudb_load_save_space OFF tokudb_lock_timeout 4000 tokudb_log_client_errors OFF tokudb_log_dir tokudb_max_lock_memory 2107940608 tokudb_pk_insert_mode 1 tokudb_prelock_empty ON tokudb_read_block_size 131072 tokudb_read_buf_size 131072 tokudb_read_status_frequency 10000 tokudb_row_format tokudb_default tokudb_tmp_dir tokudb_version 7.0.4 tokudb_write_status_frequency 1000
            Hide
            jan.reges Ján Regeš added a comment -

            Hi Elena,

            big win, here :-D

            After compiling MariaDB from sources (with cmake), it works great!!!

            I was surprised, that ha_tokudb.so is part of compiled sources :o) I thought, that ha_tokudb.so is compiled only for a specific distribution and for Gentoo must be copied from others "sources".

            So, this task could be closed.

            Thank you for your great support!

            Jan

            Show
            jan.reges Ján Regeš added a comment - Hi Elena, big win, here :-D After compiling MariaDB from sources (with cmake), it works great!!! I was surprised, that ha_tokudb.so is part of compiled sources :o) I thought, that ha_tokudb.so is compiled only for a specific distribution and for Gentoo must be copied from others "sources". So, this task could be closed. Thank you for your great support! Jan
            Hide
            elenst Elena Stepanova added a comment -

            Closing as fixed assuming that the requested workaround has been successfully found, and that the actual memory leak was indeed the one that is already fixed in the recent MariaDB versions. For the issue that Alexey mentioned on the way, if it still exists, please file another bug report.

            Show
            elenst Elena Stepanova added a comment - Closing as fixed assuming that the requested workaround has been successfully found, and that the actual memory leak was indeed the one that is already fixed in the recent MariaDB versions. For the issue that Alexey mentioned on the way, if it still exists, please file another bug report.
            Hide
            jan.reges Ján Regeš added a comment -

            Hi Elena,

            one unrelated question - is already possible to download MariaDB 10.0.5 with TokuDB? I need just sources to build with cmake.

            I have this performance-related issue in MariaDB 5.5.33a: https://mariadb.atlassian.net/browse/MDEV-5255

            So, i would like to test it with TokuDB in MariaDB 10.0.5.

            Page https://downloads.mariadb.org/mariadb/10.0.5/ linked on page https://mariadb.com/kb/en/mariadb-1005-release-notes/ doesn't work yet.

            Thank you.

            Jan

            Show
            jan.reges Ján Regeš added a comment - Hi Elena, one unrelated question - is already possible to download MariaDB 10.0.5 with TokuDB? I need just sources to build with cmake. I have this performance-related issue in MariaDB 5.5.33a: https://mariadb.atlassian.net/browse/MDEV-5255 So, i would like to test it with TokuDB in MariaDB 10.0.5. Page https://downloads.mariadb.org/mariadb/10.0.5/ linked on page https://mariadb.com/kb/en/mariadb-1005-release-notes/ doesn't work yet. Thank you. Jan
            Hide
            elenst Elena Stepanova added a comment -

            Hi Ján,

            The packages are available now via the link above. Sorry for the delay.

            Show
            elenst Elena Stepanova added a comment - Hi Ján, The packages are available now via the link above. Sorry for the delay.

              People

              • Assignee:
                Unassigned
                Reporter:
                jan.reges Ján Regeš
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: