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

connect.tbl causes valgrind warnings 'Invalid read' and server crash when run with valgrind

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.0(EOL), 10.1(EOL), 10.2(EOL)
    • N/A
    • None
    • 10.2.1-5

    Description

      Stack trace from 10.1 commit 2783fc7d14bc8ad16acfeb509d3b19615023f47a

      $ perl ./mtr connect.tbl --valgrind-mysqld
      ...
      ==4781== Invalid read of size 4
      ==4781==    at 0xEE259E: vio_blocking (viosocket.c:364)
      ==4781==    by 0xEE3771: vio_socket_connect (viosocket.c:1168)
      ==4781==    by 0x800227: connect_sync_or_async (client.c:3021)
      ==4781==    by 0x8009F7: mysql_real_connect (client.c:3225)
      ==4781==    by 0xC34CE0C: MYSQLC::Open(_global*, char const*, char const*, char const*, char const*, int, char const*) (myconn.cpp:487)
      ==4781==    by 0xC374C60: TDBMYSQL::OpenDB(_global*) (tabmysql.cpp:873)
      ==4781==    by 0xC380C92: ThreadOpen (tabtbl.cpp:573)
      ==4781==    by 0x4E3D0A3: start_thread (in /lib64/libpthread-2.19.so)
      ==4781==    by 0x6CFF04C: clone (in /lib64/libc-2.19.so)
      ==4781==  Address 0x126764e0 is 112 bytes inside a block of size 612 free'd
      ==4781==    at 0x4C2A42C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==4781==    by 0xE9800A: free_memory (safemalloc.c:276)
      ==4781==    by 0xE97CC6: sf_free (safemalloc.c:194)
      ==4781==    by 0xE85902: my_free (my_malloc.c:216)
      ==4781==    by 0xEE15F7: vio_delete (vio.c:377)
      ==4781==    by 0x7FBCE7: end_server (client.c:933)
      ==4781==    by 0x80279D: mysql_close_slow_part (client.c:3937)
      ==4781==    by 0x802806: mysql_close (client.c:3948)
      ==4781==    by 0xC34DDE6: MYSQLC::Close() (myconn.cpp:1011)
      ==4781==    by 0xC375C18: TDBMYSQL::CloseDB(_global*) (tabmysql.cpp:1211)
      ==4781==    by 0xC38154F: TDBTBM::ReadNextRemote(_global*) (tabtbl.cpp:780)
      ==4781==    by 0xC38134B: TDBTBM::ReadDB(_global*) (tabtbl.cpp:745)
      ==4781==    by 0xC305E0B: CntReadNext(_global*, TDB*) (connect.cc:465)
      ==4781==    by 0xC2F98A9: ha_connect::rnd_next(unsigned char*) (ha_connect.cc:3768)
      ==4781==    by 0x83E520: handler::ha_rnd_next(unsigned char*) (handler.cc:2577)
      ==4781==    by 0x83404C: find_all_keys(THD*, Sort_param*, SQL_SELECT*, Filesort_info*, st_io_cache*, st_io_cache*, Bounded_queue<unsigned char, unsigned char>*, unsigned long long*) (filesort.cc:765)
      ...
      

      ...
      ==4781== Invalid read of size 8
      ==4781==    at 0x80110B: mysql_real_connect (client.c:3392)
      ==4781==    by 0xC34CE0C: MYSQLC::Open(_global*, char const*, char const*, char const*, char const*, int, char const*) (myconn.cpp:487)
      ==4781==    by 0xC374C60: TDBMYSQL::OpenDB(_global*) (tabmysql.cpp:873)
      ==4781==    by 0xC380C92: ThreadOpen (tabtbl.cpp:573)
      ==4781==    by 0x4E3D0A3: start_thread (in /lib64/libpthread-2.19.so)
      ==4781==    by 0x6CFF04C: clone (in /lib64/libc-2.19.so)
      ==4781==  Address 0x12673c20 is 1,264 bytes inside a block of size 1,388 free'd
      ==4781==    at 0x4C2A42C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
      ==4781==    by 0xE9800A: free_memory (safemalloc.c:276)
      ==4781==    by 0xE97CC6: sf_free (safemalloc.c:194)
      ==4781==    by 0xE85902: my_free (my_malloc.c:216)
      ==4781==    by 0x802852: mysql_close (client.c:3960)
      ==4781==    by 0xC34DDE6: MYSQLC::Close() (myconn.cpp:1011)
      ==4781==    by 0xC375C18: TDBMYSQL::CloseDB(_global*) (tabmysql.cpp:1211)
      ==4781==    by 0xC38154F: TDBTBM::ReadNextRemote(_global*) (tabtbl.cpp:780)
      ==4781==    by 0xC38134B: TDBTBM::ReadDB(_global*) (tabtbl.cpp:745)
      ==4781==    by 0xC305E0B: CntReadNext(_global*, TDB*) (connect.cc:465)
      ==4781==    by 0xC2F98A9: ha_connect::rnd_next(unsigned char*) (ha_connect.cc:3768)
      ==4781==    by 0x83E520: handler::ha_rnd_next(unsigned char*) (handler.cc:2577)
      ==4781==    by 0x83404C: find_all_keys(THD*, Sort_param*, SQL_SELECT*, Filesort_info*, st_io_cache*, st_io_cache*, Bounded_queue<unsigned char, unsigned char>*, unsigned long
       long*) (filesort.cc:765)
      ==4781==    by 0x832A88: filesort(THD*, TABLE*, st_sort_field*, unsigned int, SQL_SELECT*, unsigned long long, bool, unsigned long long*, unsigned long long*, Filesort_tracke
      r*) (filesort.cc:301)
      ==4781==    by 0x66D83D: create_sort_index(THD*, JOIN*, st_order*, unsigned long long, unsigned long long, bool) (sql_select.cc:21328)
      ==4781==    by 0x640B3A: JOIN::exec_inner() (sql_select.cc:3198)
      ==4781== 
      ==4781== Invalid read of size 8
      ==4781==    at 0x801112: mysql_real_connect (client.c:3392)
      ==4781==    by 0xC34CE0C: MYSQLC::Open(_global*, char const*, char const*, char const*, char const*, int, char const*) (myconn.cpp:487)
      ==4781==    by 0xC374C60: TDBMYSQL::OpenDB(_global*) (tabmysql.cpp:873)
      ==4781==    by 0xC380C92: ThreadOpen (tabtbl.cpp:573)
      ==4781==    by 0x4E3D0A3: start_thread (in /lib64/libpthread-2.19.so)
      ==4781==    by 0x6CFF04C: clone (in /lib64/libc-2.19.so)
      ==4781==  Address 0x8f8f8f8f8f8f8fb7 is not stack'd, malloc'd or (recently) free'd
      ...
      

      160331 14:56:53 [ERROR] mysqld got signal 11 ;
      ...
      Server version: 10.1.13-MariaDB-debug
      key_buffer_size=1048576
      read_buffer_size=131072
      max_used_connections=3
      max_threads=153
      thread_count=2
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 62975 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x0xe329ee0
      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 = 0x4116230 thread_stack 0x48400
      /bld/10.1/bin/mysqld(my_print_stacktrace+0x38)[0xe8b688]
      /bld/10.1/bin/mysqld(handle_fatal_signal+0x390)[0x837f6f]
      mysys/stacktrace.c:246(my_print_stacktrace)[0x4e44890]
      sql-common/client.c:3392(mysql_real_connect)[0x801112]
      /bld/10.1/lib/plugin/ha_connect.so(_ZN6MYSQLC4OpenEP7_globalPKcS3_S3_S3_iS3_+0x177)[0xc34ce0d]
      /bld/10.1/lib/plugin/ha_connect.so(_ZN8TDBMYSQL6OpenDBEP7_global+0xd5)[0xc374c61]
      /bld/10.1/lib/plugin/ha_connect.so(ThreadOpen+0x5f)[0xc380c93]
      /lib64/libpthread.so.0(+0x80a4)[0x4e3d0a4]
      /lib64/libc.so.6(clone+0x6d)[0x6cff04d]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0xe33ab28): SELECT * FROM total order by v desc
      

      Attachments

        Issue Links

          Activity

            People

              bertrandop Olivier Bertrand
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.