[MDEV-18457] Assertion `(bitmap->map + (bitmap->full_head_size/6*6)) <= full_head_end' failed in _ma_check_bitmap Created: 2019-02-03  Updated: 2020-05-19  Resolved: 2020-05-19

Status: Closed
Project: MariaDB Server
Component/s: Admin statements, Data Definition - Procedure, Storage Engine - Aria
Affects Version/s: 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.5.4, 10.2.33, 10.3.24, 10.4.14

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None

Attachments: File mdev18457-2.test     File mdev18457.test    

 Description   

The test case is attached as mdev18457.test. It consists of only a few statements,

  • CREATE DATABASE ...
  • CREATE PROCEDURE ...
  • CREATE PROCEDURE ...
  • CREATE PROCEDURE ...
  • SHOW PROCEDURE STATUS <= fails
  • cleanup

but the bodies of the procedures contain long strings, which make JIRA unhappy, thus the attachment.

10.4 625aa232

mysqld: /data/src/10.4/storage/maria/ma_bitmap.c:3008: _ma_check_bitmap: Assertion `(bitmap->map + (bitmap->full_head_size/6*6)) <= full_head_end' failed.
190323 21:35:27 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fe822ed5ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000056269365d50a in _ma_check_bitmap (bitmap=0x7fe80c139d98) at /data/src/10.4/storage/maria/ma_bitmap.c:3008
#9  0x000056269365be5f in set_page_bits (info=0x7fe80c12d150, bitmap=0x7fe80c139d98, page=17, fill_pattern=2) at /data/src/10.4/storage/maria/ma_bitmap.c:2355
#10 0x000056269365cb67 in _ma_bitmap_release_unused (info=0x7fe80c12d150, blocks=0x7fe80c12d1c0) at /data/src/10.4/storage/maria/ma_bitmap.c:2742
#11 0x000056269364cafe in write_block_record (info=0x7fe80c12d150, old_record=0x0, record=0x7fe80c05f3f8 "\377\376\003sp3", row=0x7fe80c12d1c0, bitmap_blocks=0x7fe80c12d1c0, head_block_is_read=1 '\001', row_pos=0x7fe81d04bc00, undo_lsn=1, old_record_checksum=0) at /data/src/10.4/storage/maria/ma_blockrec.c:3428
#12 0x000056269364d0bc in allocate_and_write_block_record (info=0x7fe80c12d150, record=0x7fe80c05f3f8 "\377\376\003sp3", row=0x7fe80c12d1c0, undo_lsn=1) at /data/src/10.4/storage/maria/ma_blockrec.c:3564
#13 0x000056269364d1ca in _ma_write_init_block_record (info=0x7fe80c12d150, record=0x7fe80c05f3f8 "\377\376\003sp3") at /data/src/10.4/storage/maria/ma_blockrec.c:3604
#14 0x000056269365f1fb in maria_write (info=0x7fe80c12d150, record=0x7fe80c05f3f8 "\377\376\003sp3") at /data/src/10.4/storage/maria/ma_write.c:157
#15 0x00005626935e260b in ha_maria::write_row (this=0x7fe80c00c1d8, buf=0x7fe80c05f3f8 "\377\376\003sp3") at /data/src/10.4/storage/maria/ha_maria.cc:1326
#16 0x0000562693108db0 in handler::ha_write_tmp_row (this=0x7fe80c00c1d8, buf=0x7fe80c05f3f8 "\377\376\003sp3") at /data/src/10.4/sql/sql_class.h:6622
#17 0x000056269311af8d in schema_table_store_record (thd=0x7fe80c000b00, table=0x7fe80c126258) at /data/src/10.4/sql/sql_show.cc:3903
#18 0x0000562693125063 in store_schema_proc (thd=0x7fe80c000b00, table=0x7fe80c126258, proc_table=0x7fe80c02c7f0, wild=0x0, full_access=true, sp_user=0x7fe81d04d570 "root@localhost") at /data/src/10.4/sql/sql_show.cc:6512
#19 0x0000562693125462 in fill_schema_proc (thd=0x7fe80c000b00, tables=0x7fe80c0163d0, cond=0x0) at /data/src/10.4/sql/sql_show.cc:6573
#20 0x000056269312f87e in get_schema_tables_result (join=0x7fe80c019048, executed_place=PROCESSED_BY_JOIN_EXEC) at /data/src/10.4/sql/sql_show.cc:8878
#21 0x00005626930c409c in JOIN::exec_inner (this=0x7fe80c019048) at /data/src/10.4/sql/sql_select.cc:4328
#22 0x00005626930c3522 in JOIN::exec (this=0x7fe80c019048) at /data/src/10.4/sql/sql_select.cc:4153
#23 0x00005626930c4bd4 in mysql_select (thd=0x7fe80c000b00, tables=0x7fe80c0163d0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x7fe80c019020, unit=0x7fe80c004a20, select_lex=0x7fe80c0051f8) at /data/src/10.4/sql/sql_select.cc:4585
#24 0x00005626930b514c in handle_select (thd=0x7fe80c000b00, lex=0x7fe80c004958, result=0x7fe80c019020, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
#25 0x000056269307e575 in execute_sqlcom_select (thd=0x7fe80c000b00, all_tables=0x7fe80c0163d0) at /data/src/10.4/sql/sql_parse.cc:6601
#26 0x0000562693073a47 in mysql_execute_command (thd=0x7fe80c000b00) at /data/src/10.4/sql/sql_parse.cc:3889
#27 0x00005626930824b5 in mysql_parse (thd=0x7fe80c000b00, rawbuf=0x7fe80c0155d8 "SHOW PROCEDURE STATUS", length=21, parser_state=0x7fe81d04f180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
#28 0x000056269306dc2a in dispatch_command (command=COM_QUERY, thd=0x7fe80c000b00, packet=0x7fe80c043351 "SHOW PROCEDURE STATUS", packet_length=21, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
#29 0x000056269306c410 in do_command (thd=0x7fe80c000b00) at /data/src/10.4/sql/sql_parse.cc:1365
#30 0x00005626931e64eb in do_handle_one_connection (connect=0x5626958c24e0) at /data/src/10.4/sql/sql_connect.cc:1398
#31 0x00005626931e625c in handle_one_connection (arg=0x5626958c24e0) at /data/src/10.4/sql/sql_connect.cc:1301
#32 0x00005626936dc0c9 in pfs_spawn_thread (arg=0x5626959b48d0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#33 0x00007fe824dc4494 in start_thread (arg=0x7fe81d050700) at pthread_create.c:333
#34 0x00007fe822f9293f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Not reproducible with this test case on 10.1.



 Comments   
Comment by Alice Sherepa [ 2019-09-06 ]

on 10.1-10.4:
/10.1/storage/maria/ma_bitmap.c:3008: _ma_check_bitmap: Assertion `(bitmap->map + (bitmap->full_head_size/6*6)) <= full_head_end' failed.

 ./mtr innodb_information_schema_tables  --cursor-protocol

10.1 0e38cd37c7be46ac2b

#3  <signal handler called>
#4  0x00007f8cd9eb6428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#5  0x00007f8cd9eb802a in __GI_abort () at abort.c:89
#6  0x00007f8cd9eaebd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5626b44a7730 "(bitmap->map + (bitmap->full_head_size/6*6)) <= full_head_end", file=file@entry=0x5626b44a6af8 "/10.1/storage/maria/ma_bitmap.c", line=line@entry=3008, function=function@entry=0x5626b44a7ae0 <__PRETTY_FUNCTION__.16157> "_ma_check_bitmap") at assert.c:92
#7  0x00007f8cd9eaec82 in __GI___assert_fail (assertion=0x5626b44a7730 "(bitmap->map + (bitmap->full_head_size/6*6)) <= full_head_end", file=0x5626b44a6af8 "/10.1/storage/maria/ma_bitmap.c", line=3008, function=0x5626b44a7ae0 <__PRETTY_FUNCTION__.16157> "_ma_check_bitmap") at assert.c:101
#8  0x00005626b3ec38e0 in _ma_check_bitmap (bitmap=0x7f8cc2e8fba8) at /10.1/storage/maria/ma_bitmap.c:3008
#9  0x00005626b3ec234d in set_page_bits (info=0x7f8cc2d47070, bitmap=0x7f8cc2e8fba8, page=17, fill_pattern=1) at /10.1/storage/maria/ma_bitmap.c:2355
#10 0x00005626b3ec2f73 in _ma_bitmap_release_unused (info=0x7f8cc2d47070, blocks=0x7f8cc2d470d8) at /10.1/storage/maria/ma_bitmap.c:2742
#11 0x00005626b3eb3100 in write_block_record (info=0x7f8cc2d47070, old_record=0x0, record=0x7f8cc2e0f888 "\205", row=0x7f8cc2d470d8, bitmap_blocks=0x7f8cc2d470d8, head_block_is_read=1 '\001', row_pos=0x7f8cdc3311c0, undo_lsn=1, old_record_checksum=0) at /10.1/storage/maria/ma_blockrec.c:3429
#12 0x00005626b3eb367e in allocate_and_write_block_record (info=0x7f8cc2d47070, record=0x7f8cc2e0f888 "\205", row=0x7f8cc2d470d8, undo_lsn=1) at /10.1/storage/maria/ma_blockrec.c:3565
#13 0x00005626b3eb3791 in _ma_write_init_block_record (info=0x7f8cc2d47070, record=0x7f8cc2e0f888 "\205") at /10.1/storage/maria/ma_blockrec.c:3605
#14 0x00005626b3ec55a0 in maria_write (info=0x7f8cc2d47070, record=0x7f8cc2e0f888 "\205") at /10.1/storage/maria/ma_write.c:156
#15 0x00005626b3e4ddf5 in ha_maria::write_row (this=0x7f8cc2cb1888, buf=0x7f8cc2e0f888 "\205") at /10.1/storage/maria/ha_maria.cc:1279
#16 0x00005626b3ac1a97 in handler::ha_write_tmp_row (this=0x7f8cc2cb1888, buf=0x7f8cc2e0f888 "\205") at /10.1/sql/sql_class.h:5582
#17 0x00005626b3b197cb in select_union::send_data (this=0x7f8cc2d81088, values=...) at /10.1/sql/sql_union.cc:77
#18 0x00005626b3aac995 in end_send (join=0x7f8cc2d81258, join_tab=0x7f8cc2d824b8, end_of_records=false) at /10.1/sql/sql_select.cc:19713
#19 0x00005626b3aaa6e4 in evaluate_join_record (join=0x7f8cc2d81258, join_tab=0x7f8cc2d82170, error=0) at /10.1/sql/sql_select.cc:18798
#20 0x00005626b3aaa189 in sub_select (join=0x7f8cc2d81258, join_tab=0x7f8cc2d82170, end_of_records=false) at /10.1/sql/sql_select.cc:18614
#21 0x00005626b3aa9842 in do_select (join=0x7f8cc2d81258, fields=0x7f8cc2c45970, table=0x0, procedure=0x0) at /10.1/sql/sql_select.cc:18230
#22 0x00005626b3a8353a in JOIN::exec_inner (this=0x7f8cc2d81258) at /10.1/sql/sql_select.cc:3277
#23 0x00005626b3a807cd in JOIN::exec (this=0x7f8cc2d81258) at /10.1/sql/sql_select.cc:2564
#24 0x00005626b3a83d5b in mysql_select (thd=0x7f8ccf762070, rref_pointer_array=0x7f8cc2c45b00, tables=0x7f8cc2c46760, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2417232640, result=0x7f8cc2d81088, unit=0x7f8cc2c45150, select_lex=0x7f8cc2c45858) at /10.1/sql/sql_select.cc:3501
#25 0x00005626b3a79426 in handle_select (thd=0x7f8ccf762070, lex=0x7f8cc2c45088, result=0x7f8cc2d81088, setup_tables_done_option=0) at /10.1/sql/sql_select.cc:389
#26 0x00005626b3a48537 in execute_sqlcom_select (thd=0x7f8ccf762070, all_tables=0x7f8cc2c46760) at /10.1/sql/sql_parse.cc:5691
#27 0x00005626b3a3f34e in mysql_execute_command (thd=0x7f8ccf762070) at /10.1/sql/sql_parse.cc:3038
#28 0x00005626b3df08e4 in mysql_open_cursor (thd=0x7f8ccf762070, result=0x7f8cc2dc6528, pcursor=0x7f8cc2dc6590) at /10.1/sql/sql_cursor.cc:141
#29 0x00005626b3a67003 in Prepared_statement::execute (this=0x7f8cc2dc6470, expanded_query=0x7f8cdc332ea0, open_cursor=true) at /10.1/sql/sql_prepare.cc:4342
#30 0x00005626b3a65f1f in Prepared_statement::execute_loop (this=0x7f8cc2dc6470, expanded_query=0x7f8cdc332ea0, open_cursor=true, packet=0x7f8cd165507a "def\004test\002t1\002t1\rhelp_topic_id\rhelp_topic_id\f?", packet_end=0x7f8cd165507a "def\004test\002t1\002t1\rhelp_topic_id\rhelp_topic_id\f?") at /10.1/sql/sql_prepare.cc:3994
#31 0x00005626b3a63cd0 in mysqld_stmt_execute (thd=0x7f8ccf762070, packet_arg=0x7f8cd1655071 "", packet_length=9) at /10.1/sql/sql_prepare.cc:3023
#32 0x00005626b3a3af94 in dispatch_command (command=COM_STMT_EXECUTE, thd=0x7f8ccf762070, packet=0x7f8cd1655071 "", packet_length=9) at /10.1/sql/sql_parse.cc:1443
#33 0x00005626b3a3a060 in do_command (thd=0x7f8ccf762070) at /10.1/sql/sql_parse.cc:1131
#34 0x00005626b3b77d3d in do_handle_one_connection (thd_arg=0x7f8ccf762070) at /10.1/sql/sql_connect.cc:1331
#35 0x00005626b3b77a77 in handle_one_connection (arg=0x7f8ccf762070) at /10.1/sql/sql_connect.cc:1242
#36 0x00005626b4285be8 in pfs_spawn_thread (arg=0x7f8cd3bc0670) at /10.1/storage/perfschema/pfs.cc:1861
#37 0x00007f8cda8dd6ba in start_thread (arg=0x7f8cdc334700) at pthread_create.c:333
#38 0x00007f8cd9f8841d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Comment by Elena Stepanova [ 2020-05-18 ]

Alice's test run above fails on 10.5 as well.
The test case from the original description doesn't fail on 10.5 (still fails on previous versions), but here is another one which fails on 10.5 as well: mdev18457-2.test

10.5 69077dea

mariadbd: /data/src/10.5/storage/maria/ma_bitmap.c:3008: _ma_check_bitmap: Assertion `(bitmap->map + (bitmap->full_head_size/6*6)) <= full_head_end' failed.
200518 16:45:08 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fe5bf88ff12 in __GI___assert_fail (assertion=0x55af96140468 "(bitmap->map + (bitmap->full_head_size/6*6)) <= full_head_end", file=0x55af9613f898 "/data/src/10.5/storage/maria/ma_bitmap.c", line=3008, function=0x55af96140800 <__PRETTY_FUNCTION__.16726> "_ma_check_bitmap") at assert.c:101
#8  0x000055af957769e2 in _ma_check_bitmap (bitmap=0x7fe5a811b960) at /data/src/10.5/storage/maria/ma_bitmap.c:3008
#9  0x000055af95775115 in set_page_bits (info=0x7fe5a81f1ed8, bitmap=0x7fe5a811b960, page=17, fill_pattern=1) at /data/src/10.5/storage/maria/ma_bitmap.c:2355
#10 0x000055af95775f54 in _ma_bitmap_release_unused (info=0x7fe5a81f1ed8, blocks=0x7fe5a81f1f58) at /data/src/10.5/storage/maria/ma_bitmap.c:2742
#11 0x000055af95764ea7 in write_block_record (info=0x7fe5a81f1ed8, old_record=0x0, record=0x7fe5a81dcaf0 "\301\003def", row=0x7fe5a81f1f58, bitmap_blocks=0x7fe5a81f1f58, head_block_is_read=1 '\001', row_pos=0x7fe5ba42aed0, undo_lsn=1, old_record_checksum=0) at /data/src/10.5/storage/maria/ma_blockrec.c:3433
#12 0x000055af957654e3 in allocate_and_write_block_record (info=0x7fe5a81f1ed8, record=0x7fe5a81dcaf0 "\301\003def", row=0x7fe5a81f1f58, undo_lsn=1) at /data/src/10.5/storage/maria/ma_blockrec.c:3569
#13 0x000055af957655fc in _ma_write_init_block_record (info=0x7fe5a81f1ed8, record=0x7fe5a81dcaf0 "\301\003def") at /data/src/10.5/storage/maria/ma_blockrec.c:3609
#14 0x000055af957787df in maria_write (info=0x7fe5a81f1ed8, record=0x7fe5a81dcaf0 "\301\003def") at /data/src/10.5/storage/maria/ma_write.c:157
#15 0x000055af956f32d7 in ha_maria::write_row (this=0x7fe5a8115070, buf=0x7fe5a81dcaf0 "\301\003def") at /data/src/10.5/storage/maria/ha_maria.cc:1256
#16 0x000055af951b23cf in handler::ha_write_tmp_row (this=0x7fe5a8115070, buf=0x7fe5a81dcaf0 "\301\003def") at /data/src/10.5/sql/sql_class.h:6939
#17 0x000055af951c49c1 in schema_table_store_record (thd=0x7fe5a8000b18, table=0x7fe5a81381c0) at /data/src/10.5/sql/sql_show.cc:3860
#18 0x000055af951d57c2 in copy_event_to_schema_table (thd=0x7fe5a8000b18, sch_table=0x7fe5a81381c0, event_table=0x7fe5a8112b28) at /data/src/10.5/sql/sql_show.cc:7717
#19 0x000055af95672365 in Event_db_repository::index_read_for_db_for_i_s (this=0x55af9984bf70, thd=0x7fe5a8000b18, schema_table=0x7fe5a81381c0, event_table=0x7fe5a8112b28, db=0x7fe5a80139e0 "test") at /data/src/10.5/sql/event_db_repository.cc:450
#20 0x000055af956727d4 in Event_db_repository::fill_schema_events (this=0x55af9984bf70, thd=0x7fe5a8000b18, i_s_table=0x7fe5a8015318, db=0x7fe5a80139e0 "test") at /data/src/10.5/sql/event_db_repository.cc:565
#21 0x000055af95282967 in Events::fill_schema_events (thd=0x7fe5a8000b18, tables=0x7fe5a8015318) at /data/src/10.5/sql/events.cc:846
#22 0x000055af951d88d3 in get_schema_tables_result (join=0x7fe5a8016820, executed_place=PROCESSED_BY_JOIN_EXEC) at /data/src/10.5/sql/sql_show.cc:8653
#23 0x000055af95168dae in JOIN::exec_inner (this=0x7fe5a8016820) at /data/src/10.5/sql/sql_select.cc:4421
#24 0x000055af951681b9 in JOIN::exec (this=0x7fe5a8016820) at /data/src/10.5/sql/sql_select.cc:4245
#25 0x000055af951698ea in mysql_select (thd=0x7fe5a8000b18, tables=0x7fe5a8015318, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2684619520, result=0x7fe5a80167f8, unit=0x7fe5a8004b28, select_lex=0x7fe5a8005328) at /data/src/10.5/sql/sql_select.cc:4669
#26 0x000055af95159400 in handle_select (thd=0x7fe5a8000b18, lex=0x7fe5a8004a60, result=0x7fe5a80167f8, setup_tables_done_option=0) at /data/src/10.5/sql/sql_select.cc:429
#27 0x000055af9511ea36 in execute_sqlcom_select (thd=0x7fe5a8000b18, all_tables=0x7fe5a8015318) at /data/src/10.5/sql/sql_parse.cc:6172
#28 0x000055af9511ed45 in execute_show_status (thd=0x7fe5a8000b18, all_tables=0x7fe5a8015318) at /data/src/10.5/sql/sql_parse.cc:6214
#29 0x000055af95115a21 in mysql_execute_command (thd=0x7fe5a8000b18) at /data/src/10.5/sql/sql_parse.cc:3819
#30 0x000055af951238e4 in mysql_parse (thd=0x7fe5a8000b18, rawbuf=0x7fe5a8013950 "show events", length=11, parser_state=0x7fe5ba42d520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7957
#31 0x000055af9510fbec in dispatch_command (command=COM_QUERY, thd=0x7fe5a8000b18, packet=0x7fe5a8041819 "show events", packet_length=11, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1840
#32 0x000055af9510e37e in do_command (thd=0x7fe5a8000b18) at /data/src/10.5/sql/sql_parse.cc:1359
#33 0x000055af952b1951 in do_handle_one_connection (connect=0x55af9990ef68, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1411
#34 0x000055af952b16b9 in handle_one_connection (arg=0x55af99963228) at /data/src/10.5/sql/sql_connect.cc:1313
#35 0x000055af957e71cc in pfs_spawn_thread (arg=0x55af998eb838) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#36 0x00007fe5c18184a4 in start_thread (arg=0x7fe5ba42e700) at pthread_create.c:456
#37 0x00007fe5bf94cd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Comment by Michael Widenius [ 2020-05-19 ]

The problem was that full_head_size was not calculated correctly in the case when insert_order was enforced, which is the case for SHOW commands.
Pushed into 10.2

Generated at Thu Feb 08 08:44:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.