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

Assertion `str[strlen(str)-1] != '\n'' failed in my_message_sql upon REPAIR .. USE_FRM with encryption enabled

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.6, 10.11, 11.4, 11.8, 10.5(EOL)
    • 10.11.14, 11.4.8, 11.8.3
    • Debug
    • None
    • Not for Release Notes

    Description

      --source suite/encryption/include/have_file_key_management_plugin.inc
       
      SET @aria_encrypt= @@aria_encrypt_tables;
       
      CREATE TABLE t (a INT) ENGINE=Aria;
      INSERT INTO t VALUES (1);
      SET GLOBAL aria_encrypt_tables= ON;
      REPAIR TABLE t USE_FRM;
       
      DROP TABLE t;
      SET GLOBAL aria_encrypt_tables= @aria_encrypt;
      

      10.11 2263c8a1f7db9b308e1458d1ddc4203d006940d7

      mariadbd: /data/bld/10.11-asan-ubsan/sql/mysqld.cc:3351: void my_message_sql(uint, const char*, myf): Assertion `str[strlen(str)-1] != '\n'' failed.
      250506  2:25:30 [ERROR] /share8t/bld/10.11-asan-ubsan/sql/mariadbd got signal 6 ;
       
      #10 0x00007fd025053eb2 in __GI___assert_fail (assertion=0x55863571e6e0 "str[strlen(str)-1] != '\\n'", file=0x55863571a4a0 "/data/bld/10.11-asan-ubsan/sql/mysqld.cc", line=3351, function=0x55863571e4c0 "void my_message_sql(uint, const char*, myf)") at ./assert/assert.c:101
      #11 0x00005586317e018a in my_message_sql (error=<optimized out>, str=0x7fd01b032ab0 "failed to decrypt './test/t'  rc: -1  dstlen: 0  size: 8172\n", MyFlags=<optimized out>) at /data/bld/10.11-asan-ubsan/sql/mysqld.cc:3351
      #12 0x000055863531d0a4 in my_printf_error (error=error@entry=192, format=format@entry=0x558635cf57c0 "failed to decrypt '%s'  rc: %d  dstlen: %u  size: %u\n", MyFlags=MyFlags@entry=4160) at /data/bld/10.11-asan-ubsan/mysys/my_error.c:153
      #13 0x0000558633e56f87 in ma_decrypt (share=share@entry=0x620000012098, crypt_data=<optimized out>, src=src@entry=0x62500024b928 "", dst=dst@entry=0x7fd01d89e010 "", size=size@entry=8172, pageno=pageno@entry=1, lsn=<optimized out>, key_version=<optimized out>) at /data/bld/10.11-asan-ubsan/storage/maria/ma_crypt.c:541
      #14 0x0000558633e5820c in ma_crypt_data_post_read_hook (res=<optimized out>, args=0x7fd01b032fc0) at /data/bld/10.11-asan-ubsan/storage/maria/ma_crypt.c:252
      #15 0x0000558633e0d532 in read_block (pagecache=pagecache@entry=0x55863ec75e20 <maria_pagecache_var>, block=block@entry=0x7fd01d7a28d8, primary=<optimized out>) at /data/bld/10.11-asan-ubsan/storage/maria/ma_pagecache.c:3099
      #16 0x0000558633e2693b in pagecache_read (pagecache=0x55863ec75e20 <maria_pagecache_var>, file=file@entry=0x6290002856a8, pageno=pageno@entry=1, level=level@entry=0, buff=buff@entry=0x629000296218 "", type=type@entry=PAGECACHE_READ_UNKNOWN_PAGE, lock=<optimized out>, page_link=0x7fd01b033100) at /data/bld/10.11-asan-ubsan/storage/maria/ma_pagecache.c:3786
      #17 0x0000558633f685a2 in _ma_safe_scan_block_record (sort_info=sort_info@entry=0x7fd01b033760, info=info@entry=0x629000285218, record=<optimized out>) at /data/bld/10.11-asan-ubsan/storage/maria/ma_check.c:6880
      #18 0x0000558633f95233 in sort_get_next_record (sort_param=sort_param@entry=0x7fd01b033b00) at /data/bld/10.11-asan-ubsan/storage/maria/ma_check.c:5003
      #19 0x0000558633f9a9e9 in maria_repair (param=<optimized out>, info=0x629000285218, name=<optimized out>, rep_quick=<optimized out>) at /data/bld/10.11-asan-ubsan/storage/maria/ma_check.c:2814
      #20 0x0000558633da2a05 in ha_maria::repair (this=this@entry=0x625000249148, thd=thd@entry=0x62c0000b0218, param=param@entry=0x7fd019929838, do_optimize=do_optimize@entry=false) at /data/bld/10.11-asan-ubsan/storage/maria/ha_maria.cc:1719
      #21 0x0000558633da4a8d in ha_maria::repair (this=0x625000249148, thd=0x62c0000b0218, check_opt=<optimized out>) at /data/bld/10.11-asan-ubsan/storage/maria/ha_maria.cc:1489
      #22 0x0000558633210709 in handler::ha_repair (this=this@entry=0x625000249148, thd=thd@entry=0x62c0000b0218, check_opt=check_opt@entry=0x62c0000b5a08) at /data/bld/10.11-asan-ubsan/sql/handler.cc:5164
      #23 0x00005586327e7d08 in mysql_admin_table (thd=thd@entry=0x62c0000b0218, tables=tables@entry=0x62d00005a530, check_opt=check_opt@entry=0x62c0000b5a08, operator_name=operator_name@entry=0x5586366aa9c0 <msg_repair>, lock_type=lock_type@entry=TL_WRITE, org_open_for_modify=org_open_for_modify@entry=true, repair_table_use_frm=<optimized out>, extra_open_options=<optimized out>, prepare_func=<optimized out>, operator_func=<optimized out>, view_operator_func=<optimized out>, is_cmd_replicated=<optimized out>) at /data/bld/10.11-asan-ubsan/sql/sql_admin.cc:915
      #24 0x00005586327f4845 in Sql_cmd_repair_table::execute (this=<optimized out>, thd=0x62c0000b0218) at /data/bld/10.11-asan-ubsan/sql/sql_admin.cc:1644
      #25 0x0000558631f6fdfa in mysql_execute_command (thd=thd@entry=0x62c0000b0218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:6167
      #26 0x0000558631f744af in mysql_parse (thd=thd@entry=0x62c0000b0218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fd01b037ab0) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:8179
      #27 0x0000558631f7d783 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62c0000b0218, packet=packet@entry=0x62900024e219 "", packet_length=packet_length@entry=22, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1905
      #28 0x0000558631f8a3bf in do_command (thd=thd@entry=0x62c0000b0218, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1418
      #29 0x000055863277d832 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x608000003a38, put_in_cache=put_in_cache@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1386
      #30 0x000055863277e98f in handle_one_connection (arg=0x608000003a38) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1298
      #31 0x00005586340da82b in pfs_spawn_thread (arg=0x617000005b98) at /data/bld/10.11-asan-ubsan/storage/perfschema/pfs.cc:2201
      #32 0x00007fd0250a81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #33 0x00007fd02512885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The non-debug error is

      REPAIR TABLE t USE_FRM;
      Table	Op	Msg_type	Msg_text
      test.t	repair	info	Wrong CRC on datapage at 1
      test.t	repair	Error	failed to decrypt './test/t'  rc: -1  dstlen: 0  size: 8172
       
      test.t	repair	status	OK
      DROP TABLE t;
      SET GLOBAL aria_encrypt_tables= @aria_encrypt;
      bug.r18 'cbc'                            [ fail ]  Found warnings/errors in server log file!
              Test ended at 2025-05-06 02:26:51
      line
      2025-05-06  2:26:51 4 [ERROR] mariadbd: failed to decrypt './test/t'  rc: -1  dstlen: 0  size: 8172
      ^ Found warnings in /share8t/bld/10.11-rel/mysql-test/var/log/mysqld.1.err
      

      I'm not really sure whether it's expected, but it has been so for a long time, maybe USE_FRM gets confused when the table was created without encryption but it was enabled later. Anyway this report is about my_message_sql.

      The assertion was added by this commit in 10.5

      commit 82fd202fa4c417a0be4f09028dfdc88f8d902130
      Author: Sergei Golubchik
      Date:   Wed Jan 8 18:42:37 2025 +0100
       
          fix "enforce no trailing \n in Diagnostic_area messages"
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              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.