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

Valgrind warnings (Invalid read) in QPF_table_access::print_explain / String::append on a SELECT sq with DISTINCT

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 10.0.5
    • None
    • None

    Description

      ==11624== Thread 4:
      ==11624== Invalid read of size 1
      ==11624==    at 0x6BD1AB: String::append(char const*) (sql_string.cc:444)
      ==11624==    by 0x767127: QPF_table_access::print_explain(select_result_sink*, unsigned char, unsigned int, char const*, bool, bool) (opt_qpf.cc:391)
      ==11624==    by 0x766DA1: QPF_select::print_explain(QPF_query*, select_result_sink*, unsigned char) (opt_qpf.cc:314)
      ==11624==    by 0x766204: QPF_query::print_explain(select_result_sink*, unsigned char) (opt_qpf.cc:121)
      ==11624==    by 0x7662BF: QPF_query::print_explain_str(THD*, String*) (opt_qpf.cc:137)
      ==11624==    by 0x766238: print_qpf_query(LEX*, THD*, String*) (opt_qpf.cc:127)
      ==11624==    by 0x8C2544: MYSQL_QUERY_LOG::write(THD*, long, char const*, unsigned int, unsigned long long, unsigned long long, bool, char const*, unsigned int) (log.cc:2833)
      ==11624==    by 0x8BD6DF: Log_to_file_event_handler::log_slow(THD*, my_hrtime_t, char const*, unsigned int, unsigned long long, unsigned long long, bool, char const*, unsigned int) (log.cc:996)
      ==11624==    by 0x8BE1B6: LOGGER::slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:1287)
      ==11624==    by 0x8CA4FC: slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:5870)
      ==11624==    by 0x61DC5A: log_slow_statement(THD*) (sql_parse.cc:1573)
      ==11624==    by 0x61D8FE: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1495)
      ==11624==    by 0x61B8BC: do_command(THD*) (sql_parse.cc:812)
      ==11624==    by 0x7360B4: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==11624==    by 0x735E22: handle_one_connection (sql_connect.cc:1181)
      ==11624==    by 0x996C51: pfs_spawn_thread (pfs.cc:1015)
      ==11624==  Address 0xa982f90 is 576 bytes inside a block of size 1,100 free'd
      ==11624==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11624==    by 0xD1D4ED: free_memory (safemalloc.c:278)
      ==11624==    by 0xD1D1AA: sf_free (safemalloc.c:196)
      ==11624==    by 0xD09251: my_free (my_malloc.c:214)
      ==11624==    by 0xCFD04C: free_root (my_alloc.c:391)
      ==11624==    by 0x67C33C: free_tmp_table(THD*, TABLE*) (sql_select.cc:16429)
      ==11624==    by 0x5BDBB6: close_thread_tables(THD*) (sql_base.cc:1483)
      ==11624==    by 0x626808: mysql_execute_command(THD*) (sql_parse.cc:4812)
      ==11624==    by 0x629662: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:6054)
      ==11624==    by 0x61C3F3: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1097)
      ==11624==    by 0x61B8BC: do_command(THD*) (sql_parse.cc:812)
      ==11624==    by 0x7360B4: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==11624==    by 0x735E22: handle_one_connection (sql_connect.cc:1181)
      ==11624==    by 0x996C51: pfs_spawn_thread (pfs.cc:1015)
      ==11624==    by 0x545AE99: start_thread (pthread_create.c:308)
      ==11624==    by 0x619CCBC: clone (clone.S:112)
      ==11624== Invalid read of size 1
      ==11624==    at 0x4C2D0E1: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11624==    by 0x6BD15F: String::append(char const*, unsigned int) (sql_string.cc:432)
      ==11624==    by 0x6BD1CB: String::append(char const*) (sql_string.cc:444)
      ==11624==    by 0x767127: QPF_table_access::print_explain(select_result_sink*, unsigned char, unsigned int, char const*, bool, bool) (opt_qpf.cc:391)
      ==11624==    by 0x766DA1: QPF_select::print_explain(QPF_query*, select_result_sink*, unsigned char) (opt_qpf.cc:314)
      ==11624==    by 0x766204: QPF_query::print_explain(select_result_sink*, unsigned char) (opt_qpf.cc:121)
      ==11624==    by 0x7662BF: QPF_query::print_explain_str(THD*, String*) (opt_qpf.cc:137)
      ==11624==    by 0x766238: print_qpf_query(LEX*, THD*, String*) (opt_qpf.cc:127)
      ==11624==    by 0x8C2544: MYSQL_QUERY_LOG::write(THD*, long, char const*, unsigned int, unsigned long long, unsigned long long, bool, char const*, unsigned int) (log.cc:2833)
      ==11624==    by 0x8BD6DF: Log_to_file_event_handler::log_slow(THD*, my_hrtime_t, char const*, unsigned int, unsigned long long, unsigned long long, bool, char const*, unsigned int) (log.cc:996)
      ==11624==    by 0x8BE1B6: LOGGER::slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:1287)
      ==11624==    by 0x8CA4FC: slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:5870)
      ==11624==    by 0x61DC5A: log_slow_statement(THD*) (sql_parse.cc:1573)
      ==11624==    by 0x61D8FE: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1495)
      ==11624==    by 0x61B8BC: do_command(THD*) (sql_parse.cc:812)
      ==11624==    by 0x7360B4: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==11624==  Address 0xa98319b is 1,099 bytes inside a block of size 1,100 free'd
      ==11624==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11624==    by 0xD1D4ED: free_memory (safemalloc.c:278)
      ==11624==    by 0xD1D1AA: sf_free (safemalloc.c:196)
      ==11624==    by 0xD09251: my_free (my_malloc.c:214)
      ==11624==    by 0xCFD04C: free_root (my_alloc.c:391)
      ==11624==    by 0x67C33C: free_tmp_table(THD*, TABLE*) (sql_select.cc:16429)
      ==11624==    by 0x5BDBB6: close_thread_tables(THD*) (sql_base.cc:1483)
      ==11624==    by 0x626808: mysql_execute_command(THD*) (sql_parse.cc:4812)
      ==11624==    by 0x629662: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:6054)
      ==11624==    by 0x61C3F3: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1097)
      ==11624==    by 0x61B8BC: do_command(THD*) (sql_parse.cc:812)
      ==11624==    by 0x7360B4: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==11624==    by 0x735E22: handle_one_connection (sql_connect.cc:1181)
      ==11624==    by 0x996C51: pfs_spawn_thread (pfs.cc:1015)
      ==11624==    by 0x545AE99: start_thread (pthread_create.c:308)
      ==11624==    by 0x619CCBC: clone (clone.S:112)
      ==11624== Invalid read of size 8
      ==11624==    at 0x4C2D108: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11624==    by 0x6BD15F: String::append(char const*, unsigned int) (sql_string.cc:432)
      ==11624==    by 0x6BD1CB: String::append(char const*) (sql_string.cc:444)
      ==11624==    by 0x767127: QPF_table_access::print_explain(select_result_sink*, unsigned char, unsigned int, char const*, bool, bool) (opt_qpf.cc:391)
      ==11624==    by 0x766DA1: QPF_select::print_explain(QPF_query*, select_result_sink*, unsigned char) (opt_qpf.cc:314)
      ==11624==    by 0x766204: QPF_query::print_explain(select_result_sink*, unsigned char) (opt_qpf.cc:121)
      ==11624==    by 0x7662BF: QPF_query::print_explain_str(THD*, String*) (opt_qpf.cc:137)
      ==11624==    by 0x766238: print_qpf_query(LEX*, THD*, String*) (opt_qpf.cc:127)
      ==11624==    by 0x8C2544: MYSQL_QUERY_LOG::write(THD*, long, char const*, unsigned int, unsigned long long, unsigned long long, bool, char const*, unsigned int) (log.cc:2833)
      ==11624==    by 0x8BD6DF: Log_to_file_event_handler::log_slow(THD*, my_hrtime_t, char const*, unsigned int, unsigned long long, unsigned long long, bool, char const*, unsigned int) (log.cc:996)
      ==11624==    by 0x8BE1B6: LOGGER::slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:1287)
      ==11624==    by 0x8CA4FC: slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:5870)
      ==11624==    by 0x61DC5A: log_slow_statement(THD*) (sql_parse.cc:1573)
      ==11624==    by 0x61D8FE: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1495)
      ==11624==    by 0x61B8BC: do_command(THD*) (sql_parse.cc:812)
      ==11624==    by 0x7360B4: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==11624==  Address 0xa983190 is 1,088 bytes inside a block of size 1,100 free'd
      ==11624==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11624==    by 0xD1D4ED: free_memory (safemalloc.c:278)
      ==11624==    by 0xD1D1AA: sf_free (safemalloc.c:196)
      ==11624==    by 0xD09251: my_free (my_malloc.c:214)
      ==11624==    by 0xCFD04C: free_root (my_alloc.c:391)
      ==11624==    by 0x67C33C: free_tmp_table(THD*, TABLE*) (sql_select.cc:16429)
      ==11624==    by 0x5BDBB6: close_thread_tables(THD*) (sql_base.cc:1483)
      ==11624==    by 0x626808: mysql_execute_command(THD*) (sql_parse.cc:4812)
      ==11624==    by 0x629662: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:6054)
      ==11624==    by 0x61C3F3: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1097)
      ==11624==    by 0x61B8BC: do_command(THD*) (sql_parse.cc:812)
      ==11624==    by 0x7360B4: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==11624==    by 0x735E22: handle_one_connection (sql_connect.cc:1181)
      ==11624==    by 0x996C51: pfs_spawn_thread (pfs.cc:1015)
      ==11624==    by 0x545AE99: start_thread (pthread_create.c:308)
      ==11624==    by 0x619CCBC: clone (clone.S:112)
      ==11624== Invalid read of size 8
      ==11624==    at 0x4C2D11A: memcpy@@GLIBC_2.14 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11624==    by 0x6BD15F: String::append(char const*, unsigned int) (sql_string.cc:432)
      ==11624==    by 0x6BD1CB: String::append(char const*) (sql_string.cc:444)
      ==11624==    by 0x767127: QPF_table_access::print_explain(select_result_sink*, unsigned char, unsigned int, char const*, bool, bool) (opt_qpf.cc:391)
      ==11624==    by 0x766DA1: QPF_select::print_explain(QPF_query*, select_result_sink*, unsigned char) (opt_qpf.cc:314)
      ==11624==    by 0x766204: QPF_query::print_explain(select_result_sink*, unsigned char) (opt_qpf.cc:121)
      ==11624==    by 0x7662BF: QPF_query::print_explain_str(THD*, String*) (opt_qpf.cc:137)
      ==11624==    by 0x766238: print_qpf_query(LEX*, THD*, String*) (opt_qpf.cc:127)
      ==11624==    by 0x8C2544: MYSQL_QUERY_LOG::write(THD*, long, char const*, unsigned int, unsigned long long, unsigned long long, bool, char const*, unsigned int) (log.cc:2833)
      ==11624==    by 0x8BD6DF: Log_to_file_event_handler::log_slow(THD*, my_hrtime_t, char const*, unsigned int, unsigned long long, unsigned long long, bool, char const*, unsigned int) (log.cc:996)
      ==11624==    by 0x8BE1B6: LOGGER::slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:1287)
      ==11624==    by 0x8CA4FC: slow_log_print(THD*, char const*, unsigned int, unsigned long long) (log.cc:5870)
      ==11624==    by 0x61DC5A: log_slow_statement(THD*) (sql_parse.cc:1573)
      ==11624==    by 0x61D8FE: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1495)
      ==11624==    by 0x61B8BC: do_command(THD*) (sql_parse.cc:812)
      ==11624==    by 0x7360B4: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==11624==  Address 0xa983180 is 1,072 bytes inside a block of size 1,100 free'd
      ==11624==    at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==11624==    by 0xD1D4ED: free_memory (safemalloc.c:278)
      ==11624==    by 0xD1D1AA: sf_free (safemalloc.c:196)
      ==11624==    by 0xD09251: my_free (my_malloc.c:214)
      ==11624==    by 0xCFD04C: free_root (my_alloc.c:391)
      ==11624==    by 0x67C33C: free_tmp_table(THD*, TABLE*) (sql_select.cc:16429)
      ==11624==    by 0x5BDBB6: close_thread_tables(THD*) (sql_base.cc:1483)
      ==11624==    by 0x626808: mysql_execute_command(THD*) (sql_parse.cc:4812)
      ==11624==    by 0x629662: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:6054)
      ==11624==    by 0x61C3F3: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1097)
      ==11624==    by 0x61B8BC: do_command(THD*) (sql_parse.cc:812)
      ==11624==    by 0x7360B4: do_handle_one_connection(THD*) (sql_connect.cc:1266)
      ==11624==    by 0x735E22: handle_one_connection (sql_connect.cc:1181)
      ==11624==    by 0x996C51: pfs_spawn_thread (pfs.cc:1015)
      ==11624==    by 0x545AE99: start_thread (pthread_create.c:308)
      ==11624==    by 0x619CCBC: clone (clone.S:112)

      bzr version-info
      revision-id: psergey@askmonty.org-20130923101756-6fbq7b20nxkhu1bc
      revno: 3693
      branch-nick: 10.0-base-explain-slowquerylog

      SET log_slow_verbosity = 'query_plan,explain';
      SET GLOBAL slow_query_log = ON;
      SET long_query_time = 0.000001;
       
      CREATE TABLE t1 (i INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (7),(0),(9);
       
      SELECT * FROM t1 INNER JOIN ( SELECT DISTINCT * FROM t1 ) AS sq ON (sq.i = t1.i);

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.