Bug #77241 please don't crash: Over 95 percent of the buffer pool is occupied by lock heaps
Submitted: 4 Jun 2015 5:19
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S4 (Feature request)
Version:8.0.0 OS:Any
Assigned to: CPU Architecture:Any

[4 Jun 2015 5:19] Shane Bester
Description:
Crashing is not elegant after this ;)

[ERROR] [FATAL] InnoDB: Over 95 percent of the buffer pool is occupied by lock heaps or the adaptive hash index! Check that your transactions do not set too many row locks. Your buffer pool size is 128 MB. Maybe you should make the buffer pool bigger? We intentionally generate a seg fault to print a stack trace on Linux!

InnoDB: Assertion failure in thread 4416 in file ut0ut.cc line 908

mysqld.exe!my_sigabrt_handler()[my_thr_init.c:364]
mysqld.exe!raise()[winsig.c:587]
mysqld.exe!abort()[abort.c:82]
mysqld.exe!ut_dbg_assertion_failed()[ut0dbg.cc:67]
mysqld.exe!ib::fatal::~fatal()[ut0ut.cc:908]
mysqld.exe!buf_LRU_check_size_of_non_data_objects()[buf0lru.cc:1206]
mysqld.exe!buf_LRU_get_free_block()[buf0lru.cc:1290]
mysqld.exe!buf_block_alloc()[buf0buf.cc:512]
mysqld.exe!mem_heap_create_block_func()[mem0mem.cc:319]
mysqld.exe!mem_heap_add_block()[mem0mem.cc:408]
mysqld.exe!RecLock::lock_alloc()[lock0lock.cc:1437]
mysqld.exe!RecLock::create()[lock0lock.cc:1523]
mysqld.exe!lock_rec_add_to_queue()[lock0lock.cc:2119]
mysqld.exe!lock_rec_move_low()[lock0lock.cc:2806]
mysqld.exe!lock_update_merge_left()[lock0lock.cc:3445]
mysqld.exe!btr_compress()[btr0btr.cc:3517]
mysqld.exe!btr_cur_compress_if_useful()[btr0cur.cc:5044]
mysqld.exe!btr_cur_pessimistic_delete()[btr0cur.cc:5354]
mysqld.exe!row_undo_ins_remove_clust_rec()[row0uins.cc:164]
mysqld.exe!row_undo_ins()[row0uins.cc:490]
mysqld.exe!row_undo()[row0undo.cc:311]
mysqld.exe!row_undo_step()[row0undo.cc:355]
mysqld.exe!que_thr_step()[que0que.cc:1047]
mysqld.exe!que_run_threads_low()[que0que.cc:1112]
mysqld.exe!que_run_threads()[que0que.cc:1151]
mysqld.exe!trx_rollback_to_savepoint_low()[trx0roll.cc:122]
mysqld.exe!trx_rollback_for_mysql_low()[trx0roll.cc:184]
mysqld.exe!trx_rollback_for_mysql()[trx0roll.cc:271]
mysqld.exe!innobase_rollback()[ha_innodb.cc:4139]
mysqld.exe!ha_rollback_low()[handler.cc:1726]
mysqld.exe!ha_rollback_trans()[handler.cc:1796]
mysqld.exe!trans_rollback_stmt()[transaction.cc:445]
mysqld.exe!mysql_execute_command()[sql_parse.cc:4564]
mysqld.exe!mysql_parse()[sql_parse.cc:5158]
mysqld.exe!dispatch_command()[sql_parse.cc:1246]
mysqld.exe!do_command()[sql_parse.cc:816]
mysqld.exe!handle_connection()[connection_handler_per_thread.cc:300]
mysqld.exe!pfs_spawn_thread()[pfs.cc:2181]
mysqld.exe!win_thread_start()[my_thread.c:38]
mysqld.exe!_callthreadstartex()[threadex.c:376]
mysqld.exe!_threadstartex()[threadex.c:354]

How to repeat:
manually tested.

Suggested fix:
Buffer pool is now dynamic, maybe it can grow temporarily? 
Or can statement not fail more gracefully?
[4 Jun 2015 6:40] MySQL Verification Team
You may see this error message:

mysql> insert t select (@q:=@q+1) from t for update;
ERROR 1206 (HY000): The total number of locks exceeds the lock table size

So maybe it is wise to make the threshold configurable before DB_LOCK_TABLE_FULL is returned?
[8 Dec 2016 17:44] MySQL Verification Team
Another feature request for the same problem:

https://bugs.mysql.com/bug.php?id=83986