[MDEV-27754] Innodb assertion with innodb_flush_log_at_trx_commit=2 and innodb_flush_method=O_DSYNC Created: 2022-02-06  Updated: 2022-02-09  Resolved: 2022-02-08

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.5, 10.6, 10.7
Fix Version/s: 10.5.15, 10.6.7, 10.7.3, 10.8.2

Type: Bug Priority: Critical
Reporter: Vladislav Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None
Environment:

Windows Server 2019, IIS, php8


Attachments: File my.ini     PNG File screenshot-1.png    

 Description   

Time by time (2-3 times per day) MariaDB server is crashed
I don't use drive D in OS
Error log:
2022-02-02 18:49:23 0x5820 InnoDB: Assertion failure in file D:\winx64-packages\build\src\storage\innobase\log\log0log.cc line 634
InnoDB: Failing assertion: lsn >= log_sys.get_flushed_lsn()
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mariadbd startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/
InnoDB: about forcing recovery.
220202 18:49:23 [ERROR] mysqld got exception 0x80000003 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.

To report this bug, see https://mariadb.com/kb/en/reporting-bugs

We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

Server version: 10.6.5-MariaDB
key_buffer_size=1073741824
read_buffer_size=131072
max_used_connections=86
max_threads=65537
thread_count=8
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 143678805 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
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...
server.dll!my_parameter_handler()[my_init.c:278]
ucrtbase.dll!raise()
ucrtbase.dll!abort()
server.dll!ut_dbg_assertion_failed()[ut0dbg.cc:60]
server.dll!log_write_flush_to_disk_low()[log0log.cc:634]
server.dll!log_write_up_to()[log0log.cc:836]
server.dll!buf_dblwr_t::flush_buffered_writes_completed()[buf0dblwr.cc:678]
server.dll!fil_aio_callback()[fil0fil.cc:2909]
server.dll!io_callback()[os0file.cc:3614]
server.dll!tpool::task_group::execute()[task_group.cc:56]
KERNEL32.DLL!LCMapStringEx()
ntdll.dll!RtlAddRefActivationContext()
ntdll.dll!RtlAcquireSRWLockExclusive()
KERNEL32.DLL!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
information that should help you find out what is causing the crash.
Writing a core file at C:\Program Files\MariaDB 10.6\data\



 Comments   
Comment by Vladislav Vaintroub [ 2022-02-06 ]

Zh, There should be mysqld.dmp file in C:\Program Files\MariaDB 10.6\data\ . Could you please attach it here, too ?
Do not worry about D:\winx64-packages\build\src\storage\innobase\log\log0log.cc in error message. it refers is the location of the source file during compilation, on our compile server.
Also please attach your my.ini

Comment by Vladislav [ 2022-02-06 ]

I cant't fount this file

Comment by Vladislav Vaintroub [ 2022-02-06 ]

Ok, thanks!

I think I could guess what happened here, even without crash dump
There is a concurrency bug which will pop up when innodb_flush_method=O_DSYNC, and the odds of crash are much higher if innodb_flush_log_at_trx_commit = 2 .

As a temporary workaround, I suggest to comment out innodb_flush_method = O_DSYNC . Alternatively, use innodb_flush_log_at_trx_commit=1 (this is not absolutely safe, but would make crash highly improbable).

Comment by Vladislav Vaintroub [ 2022-02-06 ]

marko, please review https://github.com/MariaDB/server/commit/70e63796df78b6d34c65f9a9d957fd8bd46470bd

Generated at Thu Feb 08 09:55:20 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.