Recently, a production MySQL server has crashed occasionally after upgrade from 5.5 to 5.7.19. The following is the stack trace in error log and the table related to the problematic query。I had turned on the general log and every time MySQL crashed. There was a very large insert on duplicate key
query in the last few log entries.
0xf4bd75 my_print_stacktrace + 53
0x7d0144 handle_fatal_signal + 1188
0x34d8a0f710 _end + -693094128
0x800b23 Field_blob::copy_blob_value(st_mem_root*) + 51
0xe9af6e mysql_prepare_blob_values(THD*, List<Item>&, st_mem_root*) + 686
0xe9b575 write_record(THD*, TABLE*, COPY_INFO*, COPY_INFO*) + 565
0xe9c952 Sql_cmd_insert::mysql_insert(THD*, TABLE_LIST*) + 2146
0xe9d16e Sql_cmd_insert::execute(THD*) + 222
0xd10279 mysql_execute_command(THD*, bool) + 4025
0xd1481d mysql_parse(THD*, Parser_state*) + 1005
0xd160ac dispatch_command(THD*, COM_DATA const*, enum_server_command) + 6188
0xd16a74 do_command(THD*) + 404
0xdea70c handle_connection + 668
0xf69d64 pfs_spawn_thread + 372
0x34d8a079d1 _end + -693126191
0x311e4e8b6d _end + 475909485
CREATE TABLE `t` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`col2` varchar(128) DEFAULT NULL,
`col3` int(11) DEFAULT NULL ,
`col4` int(11) DEFAULT NULL ,
`col5` int(11) DEFAULT NULL ,
`col6` int(11) DEFAULT NULL ,
`col7` varchar(128) DEFAULT NULL ,
`col8` varchar(1024) DEFAULT NULL ,
`report` longtext ,
`create_date` datetime DEFAULT NULL ,
`start_date` datetime DEFAULT NULL ,
`finish_date` datetime DEFAULT NULL ,
`state` varchar(128) DEFAULT NULL ,
`col9` text ,
`col10` int(11) DEFAULT NULL ,
`col11` int(11) DEFAULT NULL ,
`col12` text ,
`count_post` int(11) DEFAULT NULL ,
`count_reply` int(11) DEFAULT NULL ,
`count_link` int(11) DEFAULT NULL ,
`remark` text ,
PRIMARY KEY (`id`),
UNIQUE KEY `col2` (`col2`),
KEY `col4` (`col4`),
KEY `col5` (`col5`),
KEY `col6` (`col6`),
KEY `col7` (`col7`),
KEY `create_date` (`create_date`),
KEY `finish_date` (`finish_date`)
) ENGINE=InnoDB AUTO_INCREMENT=405597973 DEFAULT CHARSET=utf8'
Is it this a bug of 5.7.19? I have found a related issue Crash on UPDATE ON DUPLICATE KEY but I can not repeat it. How can I avoid this or how can I fixed it?
As Wilson Hauck pointed out, the following are things related to threads_%
mysql> SHOW GLOBAL STATUS LIKE 'threads_%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 1 |
| Threads_connected | 2530 |
| Threads_created | 5920 |
| Threads_running | 2 |
+-------------------+-------+
mysql> SHOW GLOBAL VARIABLES LIKE 'thread_%';
+-------------------+---------------------------+
| Variable_name | Value |
+-------------------+---------------------------+
| thread_cache_size | 8 |
| thread_handling | one-thread-per-connection |
| thread_stack | 262144 |
+-------------------+---------------------------+