Bug #89183 InnoDB: Assertion failure in thread 5416 in file btr0pcur.cc line 452
Submitted: 11 Jan 2018 9:56 Modified: 26 Jan 2018 13:39
Reporter: O. Altun Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.7.20-21 x64 OS:Windows (10 x64)
Assigned to: CPU Architecture:Any

[11 Jan 2018 9:56] O. Altun
Description:
Mysql Server Crashes with the following error-log

0x1528  
InnoDB: Assertion failure in thread 5416 in file btr0pcur.cc line 452
InnoDB: Failing assertion: page_is_comp(next_page) == page_is_comp(page)
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
09:27:25 UTC - 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.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=65536
max_used_connections=12
max_threads=151
thread_count=3
connection_count=3
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 58348 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x1e1a7255d10
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...
7ff61c728002    mysqld.exe!my_errno()
7ffa88d6ee1d    MSVCR120.dll!raise()
7ffa88d74a14    MSVCR120.dll!abort()
7ff61c8446f4    mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z()
7ff61c95657a    mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z()
7ff61c90b3e9    mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z()
7ff61c90fcd9    mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z()
7ff61c7781be    mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z()
7ff61bfe8a85    mysqld.exe!?ha_index_read_map@handler@@QEAAHPEAEPEBEKW4ha_rkey_function@@@Z()
7ff61c592a40    mysqld.exe!?join_read_first@@YAHPEAVQEP_TAB@@@Z()
7ff61c594edb    mysqld.exe!?sub_select@@YA?AW4enum_nested_loop_state@@PEAVJOIN@@PEAVQEP_TAB@@_N@Z()
7ff61c59140d    mysqld.exe!?end_write_group@@YA?AW4enum_nested_loop_state@@PEAVJOIN@@PEAVQEP_TAB@@_N@Z()
7ff61c594f37    mysqld.exe!?sub_select@@YA?AW4enum_nested_loop_state@@PEAVJOIN@@PEAVQEP_TAB@@_N@Z()
7ff61c590101    mysqld.exe!?create_intermediate_table@JOIN@@AEAA_NPEAVQEP_TAB@@PEAV?$List@VItem@@@@AEAVORDER_with_src@1@_N@Z()
7ff61c591abb    mysqld.exe!?exec@JOIN@@QEAAXXZ()
7ff61c1a05c1    mysqld.exe!?handle_query@@YA_NPEAVTHD@@PEAULEX@@PEAVQuery_result@@_K3@Z()
7ff61c014267    mysqld.exe!?execute_init_command@@YAXPEAVTHD@@PEAUst_mysql_lex_string@@PEAUst_mysql_rwlock@@@Z()
7ff61c016196    mysqld.exe!?mysql_execute_command@@YAHPEAVTHD@@_N@Z()
7ff61c574cba    mysqld.exe!?exec_core@sp_instr_stmt@@UEAA_NPEAVTHD@@PEAI@Z()
7ff61c576dc2    mysqld.exe!?reset_lex_and_exec_core@sp_lex_instr@@AEAA_NPEAVTHD@@PEAI_N@Z()
7ff61c577539    mysqld.exe!?validate_lex_and_execute_core@sp_lex_instr@@QEAA_NPEAVTHD@@PEAI_N@Z()
7ff61c575162    mysqld.exe!?execute@sp_instr_stmt@@UEAA_NPEAVTHD@@PEAI@Z()
7ff61c10429c    mysqld.exe!?execute@sp_head@@AEAA_NPEAVTHD@@_N@Z()
7ff61c105180    mysqld.exe!?execute_procedure@sp_head@@QEAA_NPEAVTHD@@PEAV?$List@VItem@@@@@Z()
7ff61c018b5e    mysqld.exe!?mysql_execute_command@@YAHPEAVTHD@@_N@Z()
7ff61c019bf3    mysqld.exe!?mysql_parse@@YAXPEAVTHD@@PEAVParser_state@@@Z()
7ff61c012c93    mysqld.exe!?dispatch_command@@YA_NPEAVTHD@@PEBTCOM_DATA@@W4enum_server_command@@@Z()
7ff61c013cda    mysqld.exe!?do_command@@YA_NPEAVTHD@@@Z()
7ff61bfba80c    mysqld.exe!handle_connection()
7ff61ca15932    mysqld.exe!?reserve@?$vector@EV?$allocator@E@std@@@std@@QEAAX_K@Z()
7ff61c727e6c    mysqld.exe!my_thread_once()
7ffa88d24f7f    MSVCR120.dll!_beginthreadex()
7ffa88d25126    MSVCR120.dll!_endthreadex()
7ffa95c11fe4    KERNEL32.DLL!BaseThreadInitThunk()
7ffa95e9efb1    ntdll.dll!RtlUserThreadStart()

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (1e1a55e96d0): SELECT SUM(d.CONTENT_SIZE),COUNT(d.IID)
    FROM ApplicationDocument ad 
      LEFT JOIN Document d ON (ad.DOCUMENT_IID=d.IID)
    WHERE ad.APPLICATION_IID=appIid
    INTO docSize,docCount
Connection ID (thread ID): 18
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

How to repeat:
1.) Starting the Service/Daemon
2.) Running a certain Tomcat Application, which initiates a DB-Connection on Start-Up.

Workaround:
Start Service again and it works afterwards.
[16 Jan 2018 21:40] O. Altun
Upgrade to 5.7.21 didn't solve the problem
[17 Jan 2018 6:36] MySQL Verification Team
Hi,

Please show us the table structures for the tables involved.
And please see if adding this to my.ini helps?

[mysqld]
internal-tmp-disk-storage-engine=MYISAM
[17 Jan 2018 12:21] O. Altun
This is the configuration-File (my.ini)

###########################################################
[client]
port=3306

[mysql]
no-beep=
default-character-set=utf8

[mysqld]
port=3306
datadir="D:\ProgramData\MySQL\MySQL Server 5.7\Data"
character-set-server=utf8
default-storage-engine=INNODB
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
log-output=FILE
general-log=0
general_log_file="ALTUN-NB.log"
slow-query-log=1
slow_query_log_file="ALTUN-NB-slow.log"
long_query_time=10
log-error="ALTUN-NB.err"
server-id=1
secure-file-priv="D:\ProgramData\MySQL\MySQL Server 5.7\Uploads"
max_connections=200
query_cache_size=0
table_open_cache=2000
tmp_table_size=16M
thread_cache_size=10
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=8M
key_buffer_size=400M
read_buffer_size=1M
read_rnd_buffer_size=0
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=8M
innodb_buffer_pool_size=400M
innodb_log_file_size=48M
innodb_thread_concurrency=9
innodb_autoextend_increment=64
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=256K
max_allowed_packet=200M
max_connect_errors=100
open_files_limit=4161
query_cache_type=0
sort_buffer_size=1M
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000

innodb_flush_method=normal
internal-tmp-disk-storage-engine=MYISAM

[mysqldump]
max_allowed_packet=200M
###########################################################

Unfortunately the option "internal-tmp-disk-storage-engine=MYISAM" didn't help

I asked for permission to provide you the table structure. That is going to be a post hidden from the public.
[25 Jan 2018 16:25] MySQL Verification Team
Hi!

We do not only require table structures, but also table contents and  the operation that lead to the assert. In order to verify the bug, we need to be able to repeat it. Otherwise, we can not verify.

Do also note that this kind of assert can happen due to hardware and OS problems. If you use ECC RAM modules, 2 bit checking and 1 bit correcting and high quality external storage, like SSD, these kind of asserts are to be expected. 

Last paragraph is irrelevant if you provide a test case that will always lead to the same assert.
[26 Jan 2018 9:10] O. Altun
I will try to provide you the data.
I have an internal SSD, and normal RAM, but never had a Problem with the Application.

Could it be that my DB is corrupted somehow? I had a Windows crash and had to reinstall everything, but i could still use my MySQL Data, as i had that on another partition. And i assume the workaround wouldn't work, if the data is really corrupted.
[26 Jan 2018 12:54] O. Altun
I found what the issue is.
It's like how i assumed corrupted Data.

A "select" on Table "document" lead to the crash.
Row 294 and maybe above was corrupted.
XML Files are in the DB as BLOBs

See attached Log-File.

I dropped the Scheme and created a new one.

Please qualify and close the Bug-Ticket.
[26 Jan 2018 13:39] MySQL Verification Team
Thank you very much for your feedback.

Now, we have learned of another possible cause of the that family of asserts. Corrupted data, particularly BLOB data can cause this.

Thank you.