Bug #86234 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
Submitted: 9 May 2017 5:27 Modified: 9 May 2017 6:14
Reporter: Roel Van de Paar Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.5.54, 5.6.35, 5.7.17, 5.6.36, 5.7.18 OS:Any
Assigned to: CPU Architecture:Any

[9 May 2017 5:27] Roel Van de Paar
InnoDB: mmap(1162733546373120 bytes) failed; errno 12
170509 15:00:10  InnoDB: Assertion failure in thread 140662116915328 in file mem0dbg.c line 684
InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N

Core was generated by `/sda/MS200317-mysql-5.5.54-linux-x86_64-debug/bin/mysqld --no-defaults --innodb'.
Program terminated with signal 6, Aborted.
#0  0x00007fee731e3741 in __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
61	  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
#0  0x00007fee731e3741 in __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x00000000007e0e08 in my_write_core (sig=6) at /git/MS55_dbg/mysys/stacktrace.c:433
#2  0x00000000006a3ea7 in handle_fatal_signal (sig=6) at /git/MS55_dbg/sql/signal_handler.cc:247
#3  <signal handler called>
#4  0x00007fee719951d7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007fee719968c8 in __GI_abort () at abort.c:90
#6  0x000000000099f04b in mem_heap_check (heap=heap@entry=0x7fee6f86f600) at /git/MS55_dbg/storage/innobase/mem/mem0dbg.c:684
#7  0x00000000009054af in mem_heap_free_func (line=1340, file_name=0xb1ebd0 "/git/MS55_dbg/storage/innobase/buf/buf0buf.c", 
    heap=0x7fee6f86f600) at /git/MS55_dbg/storage/innobase/include/mem0mem.ic:476
#8  mem_free_func (line=1340, file_name=0xb1ebd0 "/git/MS55_dbg/storage/innobase/buf/buf0buf.c", ptr=0x7fee6f86f678)
    at /git/MS55_dbg/storage/innobase/include/mem0mem.ic:567
#9  buf_pool_free (n_instances=n_instances@entry=0) at /git/MS55_dbg/storage/innobase/buf/buf0buf.c:1340
#10 0x000000000090573f in buf_pool_init (total_size=<optimized out>, n_instances=1)
    at /git/MS55_dbg/storage/innobase/buf/buf0buf.c:1311
#11 0x00000000008a8033 in innobase_start_or_create_for_mysql () at /git/MS55_dbg/storage/innobase/srv/srv0start.c:1410
#12 0x0000000000851ef4 in innobase_init (p=<optimized out>) at /git/MS55_dbg/storage/innobase/handler/ha_innodb.cc:2568
#13 0x00000000006a639f in ha_initialize_handlerton (plugin=0x7fee6fab10f8) at /git/MS55_dbg/sql/handler.cc:544
#14 0x000000000059a46d in plugin_initialize (plugin=0x7fee6fab10f8) at /git/MS55_dbg/sql/sql_plugin.cc:1111
#15 0x000000000059f606 in plugin_init (argc=argc@entry=0x1103e38 <remaining_argc>, argv=0x7fee6f82e2c0, flags=0)
    at /git/MS55_dbg/sql/sql_plugin.cc:1400
#16 0x0000000000508266 in init_server_components () at /git/MS55_dbg/sql/mysqld.cc:4004
#17 0x000000000050e355 in mysqld_main (argc=10, argv=0x7fee6f82e2c0) at /git/MS55_dbg/sql/mysqld.cc:4591
#18 0x0000000000503236 in main (argc=<optimized out>, argv=<optimized out>) at /git/MS55_dbg/sql/main.cc:25

How to repeat:

Note that other values (like 99999999999999999999999999999999) may (and do) not reproduce this issue.
[9 May 2017 5:35] Roel Van de Paar
2017-05-09 15:10:00 1716 [Note] InnoDB: Initializing buffer pool, size = 1048576.0G
InnoDB: mmap(146784802308096 bytes) failed; errno 12
2017-05-09 15:10:00 7f80e990f880  InnoDB: Assertion failure in thread 140191651133568 in file mem0dbg.cc line 680
InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N

2017-05-09T05:11:09.941658Z 0 [Note] InnoDB: Number of pools: 1
2017-05-09T05:11:09.941772Z 0 [Note] InnoDB: Using CPU crc32 instructions
2017-05-09T05:11:09.942794Z 0 [Note] InnoDB: Initializing buffer pool, total size = 1.04858e+06G, instances = 8, chunk size = 128M
[9 May 2017 6:14] MySQL Verification Team
Hello Roel,

Thank you for the report.
Observed that 5.6.36 debug builds asserts, 5.7.18 release/debug hangs while starting.