Further to MDEV-18496, there are still various cases where the server crashes/asserts when Aria encryption is enabled/used, but the plugin is not loaded. This bug will list only crashes/asserts. For "Unknown key id 1" and similar corruption errors, see MDEV-24640 instead.
Individual testcases/crashes/asserts listed in comments below.
Attachments
Issue Links
relates to
MDEV-18496Crashes, asserts, errors and hangs when Aria encryption is enabled/used, but plugin is not loaded
Closed
MDEV-24640ALTER on Aria table with aria_encrypt_tables=ON without encryption plugin corrupts table
ALTERTABLE t ADD armscii8_f CHAR(1) CHARACTERSET armscii8;
# [ERROR] mysqld: Got error '126 "Index is corrupted"'for'./test/#sql-alter-268b58-4.MAI'
And
SETGLOBAL aria_encrypt_tables=1;
CREATETABLE t (a INTKEY) ENGINE=Aria;
INSERTINTO t VALUES (1);
CHECKTABLE t quick;
And
SETGLOBAL aria_encrypt_tables=ON;
INSTALL PLUGIN Spider SONAME 'ha_spider.so';
CREATETABLE t0 (a INT,b INT UNSIGNED,c CHAR(0),d CHAR(0),e VARCHAR(0),f BINARY (0),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ENGINE=Spider;
SETGLOBAL aria_checkpoint_INTERVAL=0;
DROPTABLE t_0;
Roel Van de Paar
added a comment - - edited Please also test fix with these testcases. Thank you.
SET sql_mode= '' ;
SET GLOBAL aria_encrypt_tables=1;
SET default_storage_engine=Aria;
CREATE TABLE t (c INT ,c2 BINARY (1),c3 INT (1),c4 BINARY (1) KEY ,c5 INT UNIQUE KEY ,c6 NUMERIC (0,0) DEFAULT 3);
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
ALTER TABLE t ADD armscii8_f CHAR (1) CHARACTER SET armscii8;
# [ERROR] mysqld: Got error '126 "Index is corrupted"' for './test/#sql-alter-268b58-4.MAI'
And
SET GLOBAL aria_encrypt_tables=1;
CREATE TABLE t (a INT KEY ) ENGINE=Aria;
INSERT INTO t VALUES (1);
CHECK TABLE t quick;
And
SET GLOBAL aria_encrypt_tables= ON ;
INSTALL PLUGIN Spider SONAME 'ha_spider.so' ;
CREATE TABLE t0 (a INT ,b INT UNSIGNED,c CHAR (0),d CHAR (0),e VARCHAR (0),f BINARY (0),g BLOB,h BLOB,id INT , KEY (b), KEY (e)) ENGINE=Spider;
SET GLOBAL aria_checkpoint_INTERVAL=0;
DROP TABLE t_0;
#4 0x000055db965bb3bb in Table_triggers_list::check_n_load (thd=thd@entry=0x1462c4000d48, db=db@entry=0x1462c4029ff0, table_name=table_name@entry=0x1462c402a000, table=table@entry=0x1462c4029bf8, names_only=names_only@entry=false, flags=flags@entry=0) at /test/10.11_dbg/sql/sql_trigger.cc:1658
#5 0x000055db9644a433 in open_table_entry_fini (entry=0x1462c4029bf8, share=0x1462c4029ff0, thd=0x1462c4000d48) at /test/10.11_dbg/sql/sql_base.cc:3158
#6 open_table (thd=thd@entry=0x1462c4000d48, table_list=table_list@entry=0x1462c40a1a40, ot_ctx=ot_ctx@entry=0x146354067bf0) at /test/10.11_dbg/sql/sql_base.cc:2203
#7 0x000055db9644af34 in Locked_tables_list::reopen_tables (this=this@entry=0x1462c4004da0, thd=thd@entry=0x1462c4000d48, need_reopen=need_reopen@entry=true) at /test/10.11_dbg/sql/sql_base.cc:2866
#8 0x000055db964d7aa0 in mysql_execute_command (thd=thd@entry=0x1462c4000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:6031
#9 0x000055db964bff90 in mysql_parse (thd=thd@entry=0x1462c4000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146354068300) at /test/10.11_dbg/sql/sql_parse.cc:8023
#10 0x000055db964cd4ac in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1462c4000d48, packet=packet@entry=0x1462c400af09 "", packet_length=packet_length@entry=104, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346
#11 0x000055db964cf8f4 in do_command (thd=0x1462c4000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#12 0x000055db9662c067 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55db99ad26b8, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
#13 0x000055db9662c536 in handle_one_connection (arg=0x55db99ad26b8) at /test/10.11_dbg/sql/sql_connect.cc:1318
#14 0x000014636f11f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x000014636ed0b133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Roel Van de Paar
added a comment - This testcase:
SET GLOBAL aria_encrypt_tables=1;
SET SESSION storage_engine=Aria;
CREATE TABLE t (c INT KEY ,c2 CHAR (1),c3 TIMESTAMP );
CREATE TRIGGER t_cnt_b BEFORE UPDATE ON t FOR EACH ROW UPDATE t SET cnt=cnt;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
LOCK TABLES t WRITE,t AS t0 READ ;
SET STATEMENT sql_mode= '' FOR ALTER TABLE t CHANGE c c FLOAT (0,0) UNSIGNED,CHANGE c2 c2 FLOAT (0,0) SIGNED;
Crashes only 10.10 and 10.11:
10.11.1 50c5743adc87e1cdec1431a02558f6540fe5a6d5 (Debug)
mysqld: /test/10.11_dbg/sql/sql_trigger.cc:1658: static bool Table_triggers_list::check_n_load(THD*, const LEX_CSTRING*, const LEX_CSTRING*, TABLE*, bool, uint): Assertion `!parse_error || lex.sphead == 0' failed.
10.11.1 50c5743adc87e1cdec1431a02558f6540fe5a6d5 (Debug)
Core was generated by `/test/MD221022-mariadb-10.11.1-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGABRT, Aborted.
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x146354069700 (LWP 275768))]
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x000014636ec0e859 in __GI_abort () at abort.c:79
#2 0x000014636ec0e729 in __assert_fail_base (fmt=0x14636eda4588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55db970a3e70 "!parse_error || lex.sphead == 0", file=0x55db970a3858 "/test/10.11_dbg/sql/sql_trigger.cc", line=1658, function=<optimized out>) at assert.c:92
#3 0x000014636ec1ffd6 in __GI___assert_fail (assertion=assertion@entry=0x55db970a3e70 "!parse_error || lex.sphead == 0", file=file@entry=0x55db970a3858 "/test/10.11_dbg/sql/sql_trigger.cc", line=line@entry=1658, function=function@entry=0x55db970a3e00 "static bool Table_triggers_list::check_n_load(THD*, const LEX_CSTRING*, const LEX_CSTRING*, TABLE*, bool, uint)") at assert.c:101
#4 0x000055db965bb3bb in Table_triggers_list::check_n_load (thd=thd@entry=0x1462c4000d48, db=db@entry=0x1462c4029ff0, table_name=table_name@entry=0x1462c402a000, table=table@entry=0x1462c4029bf8, names_only=names_only@entry=false, flags=flags@entry=0) at /test/10.11_dbg/sql/sql_trigger.cc:1658
#5 0x000055db9644a433 in open_table_entry_fini (entry=0x1462c4029bf8, share=0x1462c4029ff0, thd=0x1462c4000d48) at /test/10.11_dbg/sql/sql_base.cc:3158
#6 open_table (thd=thd@entry=0x1462c4000d48, table_list=table_list@entry=0x1462c40a1a40, ot_ctx=ot_ctx@entry=0x146354067bf0) at /test/10.11_dbg/sql/sql_base.cc:2203
#7 0x000055db9644af34 in Locked_tables_list::reopen_tables (this=this@entry=0x1462c4004da0, thd=thd@entry=0x1462c4000d48, need_reopen=need_reopen@entry=true) at /test/10.11_dbg/sql/sql_base.cc:2866
#8 0x000055db964d7aa0 in mysql_execute_command (thd=thd@entry=0x1462c4000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/10.11_dbg/sql/sql_parse.cc:6031
#9 0x000055db964bff90 in mysql_parse (thd=thd@entry=0x1462c4000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x146354068300) at /test/10.11_dbg/sql/sql_parse.cc:8023
#10 0x000055db964cd4ac in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1462c4000d48, packet=packet@entry=0x1462c400af09 "", packet_length=packet_length@entry=104, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_class.h:1346
#11 0x000055db964cf8f4 in do_command (thd=0x1462c4000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#12 0x000055db9662c067 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55db99ad26b8, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
#13 0x000055db9662c536 in handle_one_connection (arg=0x55db99ad26b8) at /test/10.11_dbg/sql/sql_connect.cc:1318
#14 0x000014636f11f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#15 0x000014636ed0b133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
ERROR 192 (HY000): Got error '192 "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryptio"' for './test/t.MAI'
2023-01-13 18:55:31 4 [ERROR] mysqld: Unknown key id 1 for ./test/t. Can't continue!
2023-01-13 18:55:31 4 [ERROR] mysqld: Got error '192 "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryptio"' for './test/t.MAI'
2023-01-13 18:55:31 4 [ERROR] mysqld: Index for table 't' is corrupt; try to repair it
2023-01-13 18:55:31 4 [ERROR] mysqld: Index for table 't' is corrupt; try to repair it
What is also interesting here is that the error log shows:
2023-01-13 19:11:41 0 [Warning] You need to use --log-bin to make --binlog-format work.
However, only --binlog-format is required for the testcase, and --log-bin is not (and the server shows it as turned off).
Roel Van de Paar
added a comment - - edited This testcase:
# mysqld options required for replay: --sql_mode= --binlog_format=ROW
SET GLOBAL aria_encrypt_tables=1;
SET SESSION enforce_storage_engine=Aria;
CREATE TABLE t (c INT KEY );
INSERT INTO t VALUES (1),(1),(1),(1),(1),(1),(1),(1),(1),(1);
ALTER TABLE t CHANGE COLUMN a b BINARY ;
DELETE FROM t;
DELETE FROM t;
Produces an error where the error message seems partially cut off', i.e. "encryptio":
11.0.1 b075191ba8598af6aff5549e6e19f6255aef258a (Debug)
11.0.1-dbg>DELETE FROM t;
ERROR 192 (HY000): Got error '192 "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryptio"' for './test/t.MAI'
Error log shows the same issue:
11.0.1 b075191ba8598af6aff5549e6e19f6255aef258a (Debug)
2023-01-13 18:55:31 4 [ERROR] mysqld: Unknown key id 1 for ./test/t. Can't continue!
2023-01-13 18:55:31 4 [ERROR] mysqld: Got error '192 "Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryptio"' for './test/t.MAI'
2023-01-13 18:55:31 4 [ERROR] mysqld: Index for table 't' is corrupt; try to repair it
2023-01-13 18:55:31 4 [ERROR] mysqld: Index for table 't' is corrupt; try to repair it
What is also interesting here is that the error log shows:
11.0.1 b075191ba8598af6aff5549e6e19f6255aef258a (Debug)
2023-01-13 19:11:41 0 [Warning] You need to use --log-bin to make --binlog-format work.
However, only --binlog-format is required for the testcase, and --log-bin is not (and the server shows it as turned off).
The reason for all the failures is that we are enabling encryption for Aria but not providing any keys.
This causes a crash when reading or writing to the table.
Fixed by checking if encryption keys exists before creating the table.
This fixes all the reported test cases
Michael Widenius
added a comment - The reason for all the failures is that we are enabling encryption for Aria but not providing any keys.
This causes a crash when reading or writing to the table.
Fixed by checking if encryption keys exists before creating the table.
This fixes all the reported test cases
The reason for the MDEV reported failures is that the tests are enabling
encryption for Aria but not providing any encryption keys.
Fixed by checking if encryption keys exists before creating the table.
Other things:
maria.encrypt_wrong-key changed as we now get the error on CREATE
instead during insert.
Michael Widenius
added a comment - The reason for the MDEV reported failures is that the tests are enabling
encryption for Aria but not providing any encryption keys.
Fixed by checking if encryption keys exists before creating the table.
Other things:
maria.encrypt_wrong-key changed as we now get the error on CREATE
instead during insert.
People
Michael Widenius
Roel Van de Paar
Votes:
0Vote for this issue
Watchers:
4Start 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.
Please also test fix with these testcases. Thank you.
And
And