[MDEV-32364] Server crashes when starting server with high innodb_log_buffer_size Created: 2023-10-06  Updated: 2023-11-10  Resolved: 2023-10-06

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1, 11.2, 11.3
Fix Version/s: 10.5.23, 10.6.16, 10.10.7, 10.11.6, 11.0.4, 11.1.3, 11.2.2, 11.3.1

Type: Bug Priority: Critical
Reporter: Ramesh Sivaraman Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-24269 SIGSEGV in __memset_avx2_erms AND in ... Closed

 Description   

# mysqld options required for replay:  --innodb-log-buffer-size=1125899906842624

Leads to:

11.3.0 8ad1e26b1bafa4ed9928306efc10c047f2274108 (Debug)

Core was generated by `/test/MD080923-mariadb-11.3.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --sql'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __memset_avx2_erms ()
    at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:151
[Current thread is 1 (Thread 0x1472eeddf980 (LWP 2676706))]
(gdb) bt
#0  __memset_avx2_erms () at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:151
#1  0x000055b01b074e0c in memset (__len=<optimized out>, __ch=165, __dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71
#2  log_t::create (this=0x55b01c7fee80 <log_sys>) at /test/11.3_dbg/storage/innobase/log/log0log.cc:113
#3  0x000055b01b1c37ad in srv_start (create_new_db=<optimized out>) at /test/11.3_dbg/storage/innobase/srv/srv0start.cc:1349
#4  0x000055b01afe9278 in innodb_init (p=<optimized out>) at /test/11.3_dbg/storage/innobase/handler/ha_innodb.cc:4171
#5  0x000055b01ace073c in ha_initialize_handlerton (plugin=0x55b01cee5800) at /test/11.3_dbg/sql/handler.cc:688
#6  0x000055b01a9fc6f6 in plugin_initialize (tmp_root=tmp_root@entry=0x7ffd9debdfa0, plugin=plugin@entry=0x55b01cee5800, argc=argc@entry=0x55b01bfc0020 <remaining_argc>, argv=argv@entry=0x55b01ce2f568, options_only=<optimized out>) at /test/11.3_dbg/sql/sql_plugin.cc:1465
#7  0x000055b01a9fdd10 in plugin_init (argc=argc@entry=0x55b01bfc0020 <remaining_argc>, argv=<optimized out>, flags=0) at /test/11.3_dbg/sql/sql_plugin.cc:1758
#8  0x000055b01a8b3aba in init_server_components () at /test/11.3_dbg/sql/mysqld.cc:5271
#9  0x000055b01a8b97dd in mysqld_main (argc=<optimized out>, argv=<optimized out>) at /test/11.3_dbg/sql/mysqld.cc:5900
#10 0x000055b01a8adb76 in main (argc=<optimized out>, argv=<optimized out>) at /test/11.3_dbg/sql/main.cc:34

Bug confirmed present in:
MariaDB: 10.4.32 (dbg), 10.4.32 (opt), 10.5.23 (dbg), 10.5.23 (opt), 10.6.16 (dbg), 10.6.16 (opt), 10.9.8 (dbg), 10.9.8 (opt), 10.10.7 (dbg), 10.10.7 (opt), 10.11.6 (dbg), 10.11.6 (opt), 11.0.4 (dbg), 11.0.4 (opt), 11.1.3 (dbg), 11.1.3 (opt), 11.2.2 (dbg), 11.2.2 (opt), 11.3.0 (dbg), 11.3.0 (opt)



 Comments   
Comment by Marko Mäkelä [ 2023-10-06 ]

This would require a different fix in different major versions.

10.4 a34b989f0c0ae8a968ac5b881a41a9143c9dcdeb

2023-10-06 12:33:56 0 [ERROR] InnoDB: mmap(1125899906842624 bytes) failed; errno 12
2023-10-06 12:33:56 0x7f58da4cb940  InnoDB: Assertion failure in file /mariadb/10.4/storage/innobase/include/ut0new.h line 248
InnoDB: Failing assertion: ptr != NULL

Test case (not tested on 32-bit builds):

diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test
index 38048505aea..01c65c6f434 100644
--- a/mysql-test/suite/innodb/t/log_corruption.test
+++ b/mysql-test/suite/innodb/t/log_corruption.test
@@ -109,6 +109,11 @@ print OUT chr(0) x 1046016;
 close OUT or die;
 EOF
 
+--let $restart_parameters= $dirs --innodb-log-buffer-size=1125899906842624
+--source include/restart_mysqld.inc
+eval $check_no_innodb;
+--source include/shutdown_mysqld.inc
+
 --echo # redo log from before MariaDB 10.2.2/MySQL 5.7.9
 --let $restart_parameters= $dirs
 --source include/restart_mysqld.inc

Comment by Marko Mäkelä [ 2023-10-06 ]

It turns out that on 64-bit Microsoft Windows, the parameter is only 32 bits and the start-up attempt with a large parameter would typically refuse to fail:

2023-10-06 12:59:18 0 [Warning] option 'innodb-log-buffer-size': unsigned value 1125899906842624 adjusted to 2147482624

Comment by Marko Mäkelä [ 2023-10-11 ]

The 10.10 version of the fix took some additional effort. If a memory-mapped log is used, the parameter innodb_log_buffer_size has no effect.

Generated at Thu Feb 08 10:30:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.