Bug #87562 Assertion failure: row0mysql.cc:1076:prebuilt->magic_n == ROW_PREBUILT_ALLOCATED
Submitted: 28 Aug 2017 11:05 Modified: 1 Mar 2018 18:56
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0.4-rc-enterprise-commercial-advanced-debug OS:Any
Assigned to: CPU Architecture:Any

[28 Aug 2017 11:05] Matthias Leich
Description:
Assert hit by the daily Hudson job 
ServerQA.RQG_daily_new_alter_online_trunk_debug run #176
- running the RQG test "new_alter_online"
  with 12 concurrent sessions
- on the daily build of
  8.0.4-rc-enterprise-commercial-advanced-debug-log
  Here its mysql-trunk
  commit dc34caf4de4f68914a17dfbb7d1cfcc1ddfe62f3

Thread 1 (Thread 0x7faaa44e6700 (LWP 17412)):
#0  0x00007faab2b7f741 in pthread_kill () from /lib64/libpthread.so.0
#1  0x00000000032d3faf in my_write_core (sig=6)
    at ../../mysqlcom-pro-8.0.4-rc/mysys/stacktrace.cc:291
#2  0x000000000262ba11 in handle_fatal_signal (sig=6)
    at ../../mysqlcom-pro-8.0.4-rc/sql/signal_handler.cc:234
#3  <signal handler called>
#4  0x00007faab0f1e5f7 in raise () from /lib64/libc.so.6
#5  0x00007faab0f1fce8 in abort () from /lib64/libc.so.6
#6  0x000000000356f69b in ut_dbg_assertion_failed (expr=0x4509908 "prebuilt->magic_n == ROW_PREBUILT_ALLOCATED", file=0x45090d8 "../../../mysqlcom-pro-8.0.4-rc/storage/innobase/row/row0mysql.cc", line=1076)
    at ../../../mysqlcom-pro-8.0.4-rc/storage/innobase/ut/ut0dbg.cc:60
#7  0x00000000034a3300 in row_update_prebuilt_trx (prebuilt=0x7faa243e9dc8, trx=0x7faaa46ff8d0)
    at ../../../mysqlcom-pro-8.0.4-rc/storage/innobase/row/row0mysql.cc:1076
#8  0x0000000003320883 in ha_innobase::update_thd (this=0x7faa24428cd0, thd=0x7faa240143f0)
    at ../../../mysqlcom-pro-8.0.4-rc/storage/innobase/handler/ha_innodb.cc:3049
#9  0x000000000333f3a6 in ha_innobase::external_lock (this=0x7faa24428cd0, thd=0x7faa240143f0, lock_type=2)
    at ../../../mysqlcom-pro-8.0.4-rc/storage/innobase/handler/ha_innodb.cc:17586
#10 0x000000000277d4b2 in handler::ha_external_lock (this=0x7faa24428cd0, thd=0x7faa240143f0, lock_type=2)
    at ../../mysqlcom-pro-8.0.4-rc/sql/handler.cc:8268
#11 0x00000000028f310c in unlock_external (thd=0x7faa240143f0, table=0x7faa243f9a98, count=1)
    at ../../mysqlcom-pro-8.0.4-rc/sql/lock.cc:676
#12 0x00000000028f285e in mysql_unlock_tables (thd=0x7faa240143f0, sql_lock=0x7faa243f9a80)
    at ../../mysqlcom-pro-8.0.4-rc/sql/lock.cc:442
#13 0x00000000028f28cc in mysql_unlock_some_tables (thd=0x7faa240143f0, table=0x7faaa44e2d78, count=1)
    at ../../mysqlcom-pro-8.0.4-rc/sql/lock.cc:457
#14 0x00000000028f2ba3 in mysql_lock_remove (thd=0x7faa240143f0, locked=0x7faa243f9910, table=0x7faa24477180)
    at ../../mysqlcom-pro-8.0.4-rc/sql/lock.cc:548
#15 0x00000000022471bc in close_all_tables_for_name (thd=0x7faa240143f0, key=0x7faaa44e2e40 "managed", key_length=13, db=0x7faaa44e2e40 "managed", table_name=0x7faaa44e2e48 "t3_1", remove_from_locked_tables=false, skip_table=0x0)
    at ../../mysqlcom-pro-8.0.4-rc/sql/sql_base.cc:1524
#16 0x00000000022472f6 in close_all_tables_for_name (thd=0x7faa240143f0, share=0x7faa243aad60, remove_from_locked_tables=false, skip_table=0x0)
    at ../../mysqlcom-pro-8.0.4-rc/sql/sql_base.cc:1561
#17 0x00000000029b2287 in Sql_cmd_truncate_table::truncate_table (this=0x7faa241bfd28, thd=0x7faa240143f0, table_ref=0x7faa241bfd50)
    at ../../mysqlcom-pro-8.0.4-rc/sql/sql_truncate.cc:690
#18 0x00000000029b2556 in Sql_cmd_truncate_table::execute (this=0x7faa241bfd28, thd=0x7faa240143f0)
    at ../../mysqlcom-pro-8.0.4-rc/sql/sql_truncate.cc:751
#19 0x00000000022e2ae1 in mysql_execute_command (thd=0x7faa240143f0, first_level=true)
    at ../../mysqlcom-pro-8.0.4-rc/sql/sql_parse.cc:4660
#20 0x00000000022e4ec2 in mysql_parse (thd=0x7faa240143f0, parser_state=0x7faaa44e5420)
    at ../../mysqlcom-pro-8.0.4-rc/sql/sql_parse.cc:5448
#21 0x00000000022db04d in dispatch_command (thd=0x7faa240143f0, com_data=0x7faaa44e5d10, command=COM_QUERY)
    at ../../mysqlcom-pro-8.0.4-rc/sql/sql_parse.cc:1708
#22 0x00000000022d9b4c in do_command (thd=0x7faa240143f0)
    at ../../mysqlcom-pro-8.0.4-rc/sql/sql_parse.cc:1291
#23 0x000000000261c685 in handle_connection (arg=0x9012aa0)
    at ../../mysqlcom-pro-8.0.4-rc/sql/conn_handler/connection_handler_per_thread.cc:328
#24 0x00000000037bf74e in pfs_spawn_thread (arg=0x9118ea0)
    at ../../../mysqlcom-pro-8.0.4-rc/storage/perfschema/pfs.cc:2987
#25 0x00007faab2b7adc5 in start_thread () from /lib64/libpthread.so.0
#26 0x00007faab0fdf1ed in clone () from /lib64/libc.so.6

Snip of server error log:
...
[NOTE] [001408] /export/home/tmp/james/workspace/ServerQA.RQG_daily_new_alter_online_trunk_debug/mysql/bin/mysqld-debug: ready for connections. Version: '8.0.4-rc-enterprise-commercial-advanced-debug-log' ... MySQL Enterprise Server - Advanced Edition Debug (Commercial)
...
2017-08-27T23:32:02.394390Z 142 [ERROR] [000000] InnoDB: Assertion failure: row0mysql.cc:1076:prebuilt->magic_n == ROW_PREBUILT_ALLOCATED

...

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7faa241bf2f0): /* managed . t3_1 test . t_template_varchar InnoDB */ TRUNCATE TABLE managed . t3_1
Connection ID (thread ID): 142
Status: KILL_CONNECTION

How to repeat:
Remainings of the failing run + RQG setup and grammars + core:
/log/huge3/serverqa/log/james/ServerQA.RQG_daily_new_alter_online_trunk_debug/176/1503874990/
29.log -- RQG output of the failing run
29.tgz -- Archive with core, content of server data directory, grammars etc.
[1 Mar 2018 3:20] Bin Su
Posted by developer:
 
We may mention that the corrupted table could be truncated now in the document.
[1 Mar 2018 18:56] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.5 release, and here's the changelog entry:

        An handler that was opened for a TRUNCATE
        TABLE operation caused the operation to assert. The
        server now closes open handlers before dropping the table.      
    
        The patch for this bug also improves
        TRUNCATE TABLE error messages
        related to foreign key constraints, and makes it possible to
        truncate a corrupted table.

TRUNCATE TABLE content was also updated to mention support for truncating corrupted InnoDB tables.
https://dev.mysql.com/doc/refman/8.0/en/truncate-table.html