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

Trying to lock uninitialized mutex at storage/spider/spd_i_s.cc after failure upon startup

Details

    Description

      --let $restart_parameters= --plugin-load-add=ha_spider --transaction-read-only=on
      --source include/restart_mysqld.inc
      SELECT * FROM information_schema.SPIDER_ALLOC_MEM;
      

      10.4 a5998145ba52613e4dfa08d9fe33754d14210bf4

      [ERROR] SPIDER plugin initialization failed at 'create table if not exists mysql.spider_xa(  format_id int not null default 0,  gtrid_length int not null default 0,  bqual_length int not null default 0,  data char(128) charset binary not null default '',  status char(8) not null default '',  primary key (data, format_id, gtrid_length),  key idx1 (status)) engine=MyISAM default charset=utf8 collate=utf8_bin' by 'Cannot execute statement in a READ ONLY transaction'
      2024-02-26  0:29:32 0 [ERROR] Plugin 'SPIDER' registration as a STORAGE ENGINE failed.
      ...
      safe_mutex: Trying to lock uninitialized mutex at /data/bld/10.4-asan/storage/spider/spd_i_s.cc, line 92
      240226  0:29:32 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fa396245472 in __GI_abort () at ./stdlib/abort.c:79
      #8  0x000055c6d2f37f19 in safe_mutex_lock (mp=0x7fa38fb59da0 <spider_mem_calc_mutex>, my_flags=0, file=0x7fa38fa85d80 "/data/bld/10.4-asan/storage/spider/spd_i_s.cc", line=92) at /data/bld/10.4-asan/mysys/thr_mutex.c:248
      #9  0x00007fa38f881167 in inline_mysql_mutex_lock (that=0x7fa38fb59da0 <spider_mem_calc_mutex>, src_file=0x7fa38fa85d80 "/data/bld/10.4-asan/storage/spider/spd_i_s.cc", src_line=92) at /data/bld/10.4-asan/include/mysql/psi/mysql_thread.h:717
      #10 0x00007fa38f881cfe in spider_i_s_alloc_mem_fill_table (thd=0x62b000069208, tables=0x62b000038998, cond=0x0) at /data/bld/10.4-asan/storage/spider/spd_i_s.cc:92
      #11 0x000055c6d158f7e3 in get_schema_tables_result (join=0x62b00003a478, executed_place=PROCESSED_BY_JOIN_EXEC) at /data/bld/10.4-asan/sql/sql_show.cc:9224
      #12 0x000055c6d145a9ce in JOIN::exec_inner (this=0x62b00003a478) at /data/bld/10.4-asan/sql/sql_select.cc:4586
      #13 0x000055c6d145889a in JOIN::exec (this=0x62b00003a478) at /data/bld/10.4-asan/sql/sql_select.cc:4411
      #14 0x000055c6d145c928 in mysql_select (thd=0x62b000069208, tables=0x62b000038998, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x62b00003a448, unit=0x62b00006d130, select_lex=0x62b0000382f8) at /data/bld/10.4-asan/sql/sql_select.cc:4850
      #15 0x000055c6d142cfb9 in handle_select (thd=0x62b000069208, lex=0x62b00006d070, result=0x62b00003a448, setup_tables_done_option=0) at /data/bld/10.4-asan/sql/sql_select.cc:442
      #16 0x000055c6d1397873 in execute_sqlcom_select (thd=0x62b000069208, all_tables=0x62b000038998) at /data/bld/10.4-asan/sql/sql_parse.cc:6549
      #17 0x000055c6d13847fe in mysql_execute_command (thd=0x62b000069208) at /data/bld/10.4-asan/sql/sql_parse.cc:3980
      #18 0x000055c6d13a0b63 in mysql_parse (thd=0x62b000069208, rawbuf=0x62b000038228 "SELECT * FROM information_schema.SPIDER_ALLOC_MEM", length=49, parser_state=0x7fa38cbeac60, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:8088
      #19 0x000055c6d1376782 in dispatch_command (command=COM_QUERY, thd=0x62b000069208, packet=0x6290000cd209 "SELECT * FROM information_schema.SPIDER_ALLOC_MEM", packet_length=49, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:1857
      #20 0x000055c6d13732f1 in do_command (thd=0x62b000069208) at /data/bld/10.4-asan/sql/sql_parse.cc:1378
      #21 0x000055c6d177a80b in do_handle_one_connection (connect=0x6080000014a8) at /data/bld/10.4-asan/sql/sql_connect.cc:1419
      #22 0x000055c6d177a122 in handle_one_connection (arg=0x6080000014a8) at /data/bld/10.4-asan/sql/sql_connect.cc:1323
      #23 0x000055c6d23e0664 in pfs_spawn_thread (arg=0x615000003c88) at /data/bld/10.4-asan/storage/perfschema/pfs.cc:1869
      #24 0x00007fa3962a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #25 0x00007fa39632861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Activity

          ycp Yuchen Pei added a comment - - edited

          A draft patch:

          bb-10.5-ycp edd5f8d64332f251213f3b35c33dbc1e406c23b1
          MDEV-33538 make auxiliary spider plugins init depend on actual spider
           
          The two I_S plugins SPIDER_ALLOC_MEM and SPIDER_WRAPPER_PROTOCOL
          only makes sense if the main SPIDER plugin is installed. Further,
          SPIDER_ALLOC_MEM requires a mutex that requires SPIDER init to fill
          the table.
           
          Also fixed error handling in spider_db_init() so that failure in
          spider table init does not result in memory leak
          

          I don't think the issue is severe enough to warrant pushing to locked 10.4

          ycp Yuchen Pei added a comment - - edited A draft patch: bb-10.5-ycp edd5f8d64332f251213f3b35c33dbc1e406c23b1 MDEV-33538 make auxiliary spider plugins init depend on actual spider   The two I_S plugins SPIDER_ALLOC_MEM and SPIDER_WRAPPER_PROTOCOL only makes sense if the main SPIDER plugin is installed. Further, SPIDER_ALLOC_MEM requires a mutex that requires SPIDER init to fill the table.   Also fixed error handling in spider_db_init() so that failure in spider table init does not result in memory leak I don't think the issue is severe enough to warrant pushing to locked 10.4
          ycp Yuchen Pei added a comment - - edited

          Hi serg, ptal thank (this counts as a follow up to MDEV-31400)

          hmm, it's failing in CI. Let me try again.

          ycp Yuchen Pei added a comment - - edited Hi serg , ptal thank (this counts as a follow up to MDEV-31400 ) hmm, it's failing in CI. Let me try again.
          ycp Yuchen Pei added a comment - - edited

          Hi serg, ptal thanks (in the bb-10.5-ycp branch):

          [Revision 5f66d01cf429ef3fbf8c72ad30f9e9ca31f120e5]
          Author: Yuchen Pei <ycp@mariadb.com>
          Date: 2024-03-04 Mon 10:25:34 AEDT
           
          MDEV-33538 make auxiliary spider plugins init depend on actual spider
           
          The two I_S plugins SPIDER_ALLOC_MEM and SPIDER_WRAPPER_PROTOCOL
          only makes sense if the main SPIDER plugin is installed. Further,
          SPIDER_ALLOC_MEM requires a mutex that requires SPIDER init to fill
          the table.
           
          We also update the spider init query to override
          --transaction_read_only=on so that it does not affect the spider init.
           
          Also fixed error handling in spider_db_init() so that failure in
          spider table init does not result in memory leak
          

          It counts as a follow-up to MDEV-31400

          ycp Yuchen Pei added a comment - - edited Hi serg , ptal thanks (in the bb-10.5-ycp branch): [Revision 5f66d01cf429ef3fbf8c72ad30f9e9ca31f120e5] Author: Yuchen Pei <ycp@mariadb.com> Date: 2024-03-04 Mon 10:25:34 AEDT   MDEV-33538 make auxiliary spider plugins init depend on actual spider   The two I_S plugins SPIDER_ALLOC_MEM and SPIDER_WRAPPER_PROTOCOL only makes sense if the main SPIDER plugin is installed. Further, SPIDER_ALLOC_MEM requires a mutex that requires SPIDER init to fill the table.   We also update the spider init query to override --transaction_read_only=on so that it does not affect the spider init.   Also fixed error handling in spider_db_init() so that failure in spider table init does not result in memory leak It counts as a follow-up to MDEV-31400

          5f66d01cf42 looks ok.

          • I didn't review spider_db_init() changes much, you know that code better than me
          • sql_show.cc changes are ok
          • changes in spd_i_s.cc are kind of ok. Generally plugins shouldn't invoke internal server functions like plugin_is_ready(). Instead spider could set a global (to ha_spider.so) variable like spider_is_ready=true; at the end of initialization. But spider code is already calling internal server functions all over, one more won't make a difference.
          serg Sergei Golubchik added a comment - 5f66d01cf42 looks ok. I didn't review spider_db_init() changes much, you know that code better than me sql_show.cc changes are ok changes in spd_i_s.cc are kind of ok. Generally plugins shouldn't invoke internal server functions like plugin_is_ready() . Instead spider could set a global (to ha_spider.so ) variable like spider_is_ready=true; at the end of initialization. But spider code is already calling internal server functions all over, one more won't make a difference.
          ycp Yuchen Pei added a comment -

          thanks for the review - pushed b84d335d9df076be0cbf4b02ab21c91e905c077b to 10.5

          ycp Yuchen Pei added a comment - thanks for the review - pushed b84d335d9df076be0cbf4b02ab21c91e905c077b to 10.5

          People

            ycp Yuchen Pei
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.