Assertion failure: fsp0fsp.cc:936:memcmp(page + offset, ENCRYPTION_KEY_MAGIC_V1, ENCRYPTION_MAGIC_SIZE) == 0
Description
Environment
Smart Checklist
Activity

Julia Vural March 4, 2025 at 9:09 PM
It appears that this issue is no longer being worked on, so we are closing it for housekeeping purposes. If you believe the issue still exists, please open a new ticket after confirming it's present in the latest release.

Satya Bodapati February 11, 2020 at 3:33 PM
This is very very edge case
data on page0 shouldn't be written. Then rotation at startup modifies the master_key_id to 0. Even this write shouldn't be fushed. Then server should be killed
Next startup, would then find master_key_id as zero and then asserts encryption magic should be set. Debug assert only.
This encrypt info is anyway fixed later by rotation code at startup. (No real affect on release builds)
My efforts to get mtr testcase with debug instrumentation is in vain so far..

Satya Bodapati February 11, 2020 at 8:55 AM
od -j54 -N4 -t x1 -An tab16k_e.ibd
00 00 68 00 -> space_flags (0x6800 -> 26624 (has encryption bit set)
but doesn't have encryption info data
mohit.joshi@qaserver-06:~/test_p/531236/3/data$ od -j10390 -N111 -t x1 -An tab16k_e.ibd
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Satya Bodapati February 11, 2020 at 8:47 AM
od -j16 -N8 -t x1 -An tab16k_e.ibd
00 00 00 00 01 fa ff 41 -> 0x01faff41 -> 33226561

Satya Bodapati February 11, 2020 at 8:45 AM
encryption info is not present on page 0 and present on redo.
The information from redo is not applied to page 0 because the page_lsn(33226561) > redo_lsn(33226443)
While running pquery3, encountered this crash. The crash is reproducible with the datadir repeatedly. However, this bug can be an upstream bug. Hence reporting it as a place holder.
Stack Trace :
2020-02-07T09:54:34.333974Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: fsp0fsp.cc:936:memcmp(page + offset, ENCRYPTION_KEY_MAGIC_V1, ENCRYPTION_MAGIC_SIZE) == 0 || memcmp(page + offset, ENCRYPTION_KEY_MAGIC_V2, ENCRYPTION_MAGIC_SIZE) == 0 || memcmp(page + offset, ENCRYPTION_KEY_MAGIC_V3, ENCRYPTION_MAGIC_SIZE) == 0 thread 139925936518912
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
09:54:34 UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
Thread pointer: 0x919e610
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 = 7f430bbdad98 thread_stack 0x46000
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x55) [0x4c28b42]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(handle_fatal_signal+0x2ce) [0x3a39f6c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f4320b61390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f431eb75428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f431eb7702a]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x1c1) [0x50af2b8]/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(fsp_header_write_encryption(unsigned int, unsigned long, unsigned char*, bool, bool, mtr_t*)+0x268) [0x52d4f37]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(fsp_header_rotate_encryption(fil_space_t*, unsigned char*, mtr_t*)+0xfb) [0x52d5078]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(encryption_rotate_low(fil_space_t*)+0xeb) [0x529570a]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(Fil_system::encryption_rotate_in_a_shard(Fil_shard*)+0x24d) [0x5295ac1]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(Fil_system::encryption_rotate_all()+0x80) [0x5295bd4]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(Fil_system::encryption_rotate_all()+0x80) [0x5295bd4]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(fil_encryption_rotate()+0x13) [0x5295c25]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(srv_start(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x2e45) [0x501adea]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld() [0x4d2cc0f]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld() [0x4d3ff40]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(dd::bootstrap::DDSE_dict_init(THD*, dict_init_mode_t, unsigned int)+0xa8) [0x49bc9a9]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld(dd::upgrade_57::do_pre_checks_and_initialize_dd(THD*)+0x5c2) [0x4bdd51c]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld() [0x3b6d656]
/home/mohit.joshi/mysql-8.0/bld_PS-6739/install/bin/mysqld() [0x5416c93]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7f4320b576ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f431ec4741d]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): Connection ID (thread ID): 1
Status: NOT_KILLED
Please help us make Percona Server better by reporting any
bugs at https://bugs.percona.com/
You may download the Percona Server operations manual by visiting
http://www.percona.com/software/percona-server/. You may find information
in the manual which will help you identify the cause of the crash.
Writing a core file