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

Server crashes when calling spider UDF after aria_encrypt_tables is enabled

    XMLWordPrintable

Details

    Description

      The issue is similar to MDEV-30727, but this crash occurs when calling the spider UDF after enabling aria_encrypt_tables

      SET GLOBAL aria_encrypt_tables=ON;
      CREATE FUNCTION spider_direct_sql RETURNS INT SONAME 'ha_spider.so';
      --error ER_CANT_INITIALIZE_UDF
      INSTALL PLUGIN spider SONAME 'ha_spider.so';
      SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
      

      Leads to
      Error info

      [ERROR] SPIDER plugin initialization failed at 'if @engine_name != 'Aria' then  alter table mysql.spider_link_failed_log    engine=Aria transactional=1,    algorithm=copy, lock=shared;end if;' by 'Initialization of encryption failed for ./mysql/#sql-alter-3913b7-0'
      2024-08-01 13:38:11 4 [ERROR] Plugin 'SPIDER' registration as a STORAGE ENGINE failed.
      

      10.5.26 c038b3c05ed90041333dc869e3435c301210a3c4 (Optimized)

      Core was generated by `/test/MD300724-mariadb-10.5.26-linux-x86_64-opt/bin/mariadbd --no-defaults --ma'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x0000563a24be454b in thd_get_ha_data (thd=thd@entry=0x14644c000c58, hton=0x563a28045518) at /test/10.5_opt/sql/sql_class.cc:466
      [Current thread is 1 (Thread 0x14648ce90700 (LWP 3742386))]
      (gdb) bt
      #0  0x0000563a24be454b in thd_get_ha_data (thd=thd@entry=0x14644c000c58, hton=0x563a28045518) at /test/10.5_opt/sql/sql_class.cc:466
      #1  0x000014648cd8274d in spider_get_trx (thd=thd@entry=0x14644c000c58, regist_allocated_thds=regist_allocated_thds@entry=true, error_num=error_num@entry=0x14648ce8dbcc) at /test/10.5_opt/storage/spider/spd_trx.cc:1108
      #2  0x000014648cdc346a in spider_direct_sql_body (initid=<optimized out>, args=0x14644c010e18, is_null=<optimized out>, error=0x14644c010e88 "", bg=<optimized out>) at /test/10.5_opt/storage/spider/spd_direct_sql.cc:1304
      #3  0x0000563a24f0e0be in udf_handler::val_int (null_value=<synthetic pointer>, this=0x14644c010e08) at /test/10.5_opt/sql/sql_udf.h:108
      #4  udf_handler::val_int (null_value=<synthetic pointer>, this=0x14644c010e08) at /test/10.5_opt/sql/sql_udf.h:99
      #5  Item_func_udf_int::val_int (this=0x14644c010d40) at /test/10.5_opt/sql/item_func.cc:3855
      #6  0x0000563a24de43cd in Type_handler::Item_send_longlong (this=<optimized out>, item=0x14644c010d40, protocol=0x14644c0011d0, buf=<optimized out>) at /test/10.5_opt/sql/sql_type.cc:7607
      #7  0x0000563a24b64819 in Protocol::send_result_set_row (this=this@entry=0x14644c0011d0, row_items=row_items@entry=0x14644c0106d0) at /test/10.5_opt/sql/protocol.cc:1086
      #8  0x0000563a24bed1e7 in select_send::send_data (this=0x14644c011870, items=@0x14644c0106d0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14644c010ed0, last = 0x14644c010ed0, elements = 1}, <No data fields>}) at /test/10.5_opt/sql/sql_class.cc:3163
      #9  0x0000563a24cb66d8 in select_result_sink::send_data_with_check (u=<optimized out>, sent=0, items=<optimized out>, this=<optimized out>) at /test/10.5_opt/sql/sql_class.h:5565
      #10 select_result_sink::send_data_with_check (sent=0, u=<optimized out>, items=<optimized out>, this=<optimized out>) at /test/10.5_opt/sql/sql_class.h:5555
      #11 JOIN::exec_inner (this=0x14644c011898) at /test/10.5_opt/sql/sql_select.cc:4522
      #12 0x0000563a24cb6a68 in JOIN::exec (this=this@entry=0x14644c011898) at /test/10.5_opt/sql/sql_select.cc:4434
      #13 0x0000563a24cb4a2a in mysql_select (thd=0x14644c000c58, tables=0x0, fields=@0x14644c0106d0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14644c010ed0, last = 0x14644c010ed0, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=<optimized out>, result=0x14644c011870, unit=0x14644c004c48, select_lex=0x14644c010568) at /test/10.5_opt/sql/sql_select.cc:4911
      #14 0x0000563a24cb54b7 in handle_select (thd=thd@entry=0x14644c000c58, lex=lex@entry=0x14644c004b80, result=result@entry=0x14644c011870, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_opt/sql/sql_select.cc:449
      #15 0x0000563a24c3d86e in execute_sqlcom_select (thd=0x14644c000c58, all_tables=0x0) at /test/10.5_opt/sql/sql_parse.cc:6425
      #16 0x0000563a24c4c89b in mysql_execute_command (thd=0x14644c000c58) at /test/10.5_opt/sql/sql_parse.cc:4030
      #17 0x0000563a24c377f6 in mysql_parse (thd=0x14644c000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_parse.cc:8223
      #18 0x0000563a24c44ed5 in dispatch_command (command=COM_QUERY, thd=0x14644c000c58, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_class.h:1329
      #19 0x0000563a24c47673 in do_command (thd=0x14644c000c58) at /test/10.5_opt/sql/sql_parse.cc:1376
      #20 0x0000563a24d591c1 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x563a281380a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1417
      #21 0x0000563a24d5964d in handle_one_connection (arg=arg@entry=0x563a281380a8) at /test/10.5_opt/sql/sql_connect.cc:1319
      #22 0x0000563a2512c6e0 in pfs_spawn_thread (arg=0x563a28044428) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
      #23 0x00001464a2ab4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #24 0x00001464a26a0133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.26 (dbg), 10.5.26 (opt)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.6.19 (dbg), 10.6.19 (opt), 10.11.9 (dbg), 10.11.9 (opt), 11.1.6 (dbg), 11.1.6 (opt), 11.2.5 (dbg), 11.2.5 (opt), 11.4.3 (dbg), 11.4.3 (opt), 11.5.2 (dbg), 11.5.2 (opt), 11.6.0 (dbg), 11.6.0 (opt)

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              ramesh Ramesh Sivaraman
              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.