[MDEV-29268] mysql crashed on INSERT Created: 2022-08-08  Updated: 2022-08-11  Resolved: 2022-08-11

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Insert
Affects Version/s: 10.5.13, 10.5.16
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: TAO ZHOU Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None


 Description   

We are recently had multiple crashes.
It happened on one of the insert queries, which is included in the crash log below.
I can reproduce the crash consistently by manually executing that query.
It crashed every time I ran the INSERT query.

Then, I upgraded from 10.5.13 to 10.5.16, didn't help.

Here's the `SHOW CREATE TABLE` output

CREATE TABLE `activity` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `activity` varchar(255) NOT NULL,
  `user_id` int(10) unsigned DEFAULT NULL,
  `ts` bigint(20) unsigned DEFAULT NULL,
  `object` varchar(255) DEFAULT NULL,
  `object_id` varchar(255) DEFAULT NULL,
  `target` varchar(255) DEFAULT NULL,
  `target_id` varchar(255) DEFAULT NULL,
  `success` tinyint(4) NOT NULL DEFAULT 1,
  `meta` text DEFAULT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  PRIMARY KEY (`id`),
  KEY `activity_activity_index` (`activity`),
  KEY `activity_userid_index` (`user_id`),
  KEY `activity_userid_activity_index` (`object`,`object_id`),
  KEY `activity_target_targetid_index` (`target`,`target_id`),
  KEY `activity_activity_object_success_createdat_index` (`activity`,`object`,`success`,`created_at`),
  KEY `activity_created_at` (`created_at`),
  KEY `activity_activity_user_success_createdat_index` (`activity`,`user_id`,`success`,`created_at`),
  KEY `activity_activity_object_user_success_created_at_index` (`activity`,`object`,`object_id`,`user_id`,`success`,`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=1818966 DEFAULT CHARSET=utf8

Crash log as below

mysqld got signal 6 ;
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.
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.
Server version: 10.5.16-MariaDB-log
key_buffer_size=16777216
read_buffer_size=262144
max_used_connections=533
max_threads=3002
thread_count=534
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 7004945 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x147ef4ddc658
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...
stack_bottom = 0x1481e6875558 thread_stack 0x40000
Printing to addr2line failed
/rdsdbbin/mysql/bin/mysqld(my_print_stacktrace+0x2e)[0x55af54db73fe]
/rdsdbbin/mysql/bin/mysqld(handle_fatal_signal+0x51b)[0x55af54568a2b]
/lib64/libpthread.so.0(+0x118e0)[0x1481e7cfa8e0]
/lib64/libc.so.6(gsignal+0x110)[0x1481e7971ca0]
/lib64/libc.so.6(abort+0x148)[0x1481e7973148]
/rdsdbbin/mysql/bin/mysqld(+0x10c7b21)[0x55af54c0ab21]
/rdsdbbin/mysql/bin/mysqld(+0x10ce995)[0x55af54c11995]
/rdsdbbin/mysql/bin/mysqld(+0x10cfcba)[0x55af54c12cba]
/rdsdbbin/mysql/bin/mysqld(+0x10e1a05)[0x55af54c24a05]
/rdsdbbin/mysql/bin/mysqld(+0x1029a0a)[0x55af54b6ca0a]
/rdsdbbin/mysql/bin/mysqld(+0x102f595)[0x55af54b72595]
/rdsdbbin/mysql/bin/mysqld(+0x102f8c6)[0x55af54b728c6]
/rdsdbbin/mysql/bin/mysqld(+0x104255b)[0x55af54b8555b]
/rdsdbbin/mysql/bin/mysqld(+0xf8210f)[0x55af54ac510f]
/rdsdbbin/mysql/bin/mysqld(_ZN7handler12ha_write_rowEPKh+0x17c)[0x55af54573c9c]
/rdsdbbin/mysql/bin/mysqld(_Z12write_recordP3THDP5TABLEP12st_copy_infoP13select_result+0x19e)[0x55af5434871e]
/rdsdbbin/mysql/bin/mysqld(_Z12mysql_insertP3THDP10TABLE_LISTR4ListI4ItemERS3_IS5_ES6_S6_15enum_duplicatesbP13select_result+0x15de)[0x55af5434f34e]
/rdsdbbin/mysql/bin/mysqld(_Z21mysql_execute_commandP3THD+0x263a)[0x55af5437bb2a]
/rdsdbbin/mysql/bin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x1c0)[0x55af5437fad0]
/rdsdbbin/mysql/bin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0x15de)[0x55af54376e1e]
/rdsdbbin/mysql/bin/mysqld(_Z10do_commandP3THD+0xdd)[0x55af5437562d]
/rdsdbbin/mysql/bin/mysqld(_Z24do_handle_one_connectionP7CONNECTb+0x486)[0x55af54465656]
/rdsdbbin/mysql/bin/mysqld(handle_one_connection+0x34)[0x55af544659c4]
/rdsdbbin/mysql/bin/mysqld(+0xef3c4c)[0x55af54a36c4c]
/lib64/libpthread.so.0(+0x744b)[0x1481e7cf044b]
/lib64/libc.so.6(clone+0x3f)[0x1481e7a2b40f]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x147ef4e77db0): INSERT INTO `activity`(`id`, `activity`, `user_id`, `ts`, `object`, `object_id`, `target`, `target_id`, `success`, `meta`, `created_at`) VALUES (DEFAULT, 'click', 116692, 1659076637461, 'link', 'https://xxxxx.xxxx.com/files/11955/2022-06-15T03:00:23.404Z-Staff%20FAQ%20-%20COVID%20%20Protocols%20-%20June%202022.pdf', DEFAULT, DEFAULT, 1, '{\"platform\":\"ios\",\"sourceId\":\"10751\",\"sourceType\":\"post\",\"sourceDescription\":\"COVID-19 POSITIVE – What to do\",\"linkText\":\"click here\"}', DEFAULT)
Connection ID (thread ID): 15
Status: NOT_KILLED
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /rdsdbdata/db
Resource Limits:
Limit                     Soft Limit           Hard Limit           Units     
Max cpu time              unlimited            unlimited            seconds   
Max file size             unlimited            unlimited            bytes     
Max data size             unlimited            unlimited            bytes     
Max stack size            unlimited            unlimited            bytes     
Max core file size        0                    unlimited            bytes     
Max resident set          unlimited            unlimited            bytes     
Max processes             unlimited            unlimited            processes 
Max open files            1048576              1048576              files     
Max locked memory         65536                65536                bytes     
Max address space         unlimited            unlimited            bytes     
Max file locks            unlimited            unlimited            locks     
Max pending signals       62856                62856                signals   
Max msgqueue size         819200               819200               bytes     
Max nice priority         0                    0                    
Max realtime priority     0                    0                    
Max realtime timeout      unlimited            unlimited            us        
Core pattern: /rdsdbdata/tmp/core-%e-%p



 Comments   
Comment by Alice Sherepa [ 2022-08-08 ]

Could you please provide a full error log and the output show variables (and your configuration file(s))
It is not reproducible for me on a freshly installed 10.5.16.

Comment by TAO ZHOU [ 2022-08-10 ]

It turns out the indexes are corrupted. Not sure how they got corrupted when upgrading to 10.5.16, but it works well since I rebuilt the indexes.

Generated at Thu Feb 08 10:07:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.