[MDEV-29335] Crash after Duplicate Key error Created: 2022-08-19  Updated: 2022-10-08  Resolved: 2022-10-08

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Insert, Full-text Search, Platform RedHat
Affects Version/s: 10.6.9
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Nuno Gato Assignee: Marko Mäkelä
Resolution: Incomplete Votes: 0
Labels: Crash, assertion, centos7, mariadb, que0que
Environment:

CENTOS 7
WHM 104.0.8
MariaDB 10.6.9

Kernel version: Linux version 3.10.0-1160.62.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Tue Apr 5 16:57:59 UTC 2022


Issue Links:
Duplicate
is duplicated by MDEV-29342 Assertion failure in file que0que.cc ... Closed
Relates
relates to MDEV-15237 "Can't write; duplicate key in table"... Closed

 Description   

System with Magento and custom plugins that use Magento structure to manipulate database.

When trying to add an item InnoDB returns Duplicate Key error and MariaDB dies

2022-08-19 13:07:06 48 [ERROR] InnoDB: (Duplicate key) writing word node to FTS auxiliary index table `robosavvy_store`.`robosavvy_sparkfun_product`
2022-08-19 13:07:06 0x7fc5b804a700  InnoDB: Assertion failure in file /home/buildbot/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/mariadb-10.6.9/storage/innobase/que/que0que.cc line 728
InnoDB: Failing assertion: trx->error_state == DB_SUCCESS
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to https://jira.mariadb.org/
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mariadbd startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/
InnoDB: about forcing recovery.

Server version: 10.6.9-MariaDB
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=8
max_threads=153
thread_count=8
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 193783 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x7fc5400009b8
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 = 0x7fc5b8049cc0 thread_stack 0x49000
??:0(my_print_stacktrace)[0x5631aaf1948e]
??:0(handle_fatal_signal)[0x5631aa96a217]
sigaction.c:0(__restore_rt)[0x7fc5d67fd630]
:0(__GI_raise)[0x7fc5d5c48387]
:0(__GI_abort)[0x7fc5d5c49a78]
/usr/sbin/mariadbd(+0x685bcd)[0x5631aa622bcd]
??:0(void std::__introsort_loop<unsigned char**, long>(unsigned char**, unsigned char**, long))[0x5631aacf44c3]
??:0(void std::vector<unsigned long, std::allocator<unsigned long> >::_M_emplace_back_aux<unsigned long>(unsigned long&&))[0x5631aae7a665]
??:0(void std::vector<unsigned long, std::allocator<unsigned long> >::_M_emplace_back_aux<unsigned long>(unsigned long&&))[0x5631aae6261f]
??:0(void std::vector<unsigned long, std::allocator<unsigned long> >::_M_emplace_back_aux<unsigned long>(unsigned long&&))[0x5631aae68571]
??:0(void std::vector<unsigned long, std::allocator<unsigned long> >::_M_emplace_back_aux<unsigned long>(unsigned long&&))[0x5631aae6a52b]
??:0(void std::vector<unsigned long, std::allocator<unsigned long> >::_M_emplace_back_aux<unsigned long>(unsigned long&&))[0x5631aae6ab75]
??:0(void std::vector<unsigned long, std::allocator<unsigned long> >::_M_emplace_back_aux<unsigned long>(unsigned long&&))[0x5631aae6ae08]
??:0(std::pair<std::_Rb_tree_iterator<unsigned int>, bool> std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>, std::allocator<unsigned int> >::_M_insert_unique<unsigned int const&>(unsigned int const&))[0x5631aad8e9e8]
??:0(std::pair<std::_Rb_tree_iterator<unsigned int>, bool> std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>, std::allocator<unsigned int> >::_M_insert_unique<unsigned int const&>(unsigned int const&))[0x5631aad8ef0b]
??:0(std::pair<std::_Rb_tree_iterator<unsigned int>, bool> std::_Rb_tree<unsigned int, unsigned int, std::_Identity<unsigned int>, std::less<unsigned int>, std::allocator<unsigned int> >::_M_insert_unique<unsigned int const&>(unsigned int const&))[0x5631aad8f304]
??:0(wsrep_notify_status(wsrep::server_state::state, wsrep::view const*))[0x5631aac4d810]
??:0(ha_check_and_coalesce_trx_read_only(THD*, Ha_trx_info*, bool))[0x5631aa96d78e]
??:0(ha_commit_trans(THD*, bool))[0x5631aa97a54b]
??:0(trans_commit(THD*))[0x5631aa8537ae]
??:0(mysql_execute_command(THD*, bool))[0x5631aa747865]
??:0(mysql_parse(THD*, char*, unsigned int, Parser_state*))[0x5631aa74aa1b]
??:0(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool))[0x5631aa74cbd7]
??:0(do_command(THD*, bool))[0x5631aa74e273]
??:0(do_handle_one_connection(CONNECT*, bool))[0x5631aa844537]
??:0(handle_one_connection)[0x5631aa8447d4]
??:0(MyCTX_nopad::finish(unsigned char*, unsigned int*))[0x5631aabaf8cc]
pthread_create.c:0(start_thread)[0x7fc5d67f5ea5]
??:0(__clone)[0x7fc5d5d10b0d]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7fc540010720): COMMIT
 
Connection ID (thread ID): 48
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 /var/lib/mysql
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            8388608              unlimited            bytes
Max core file size        0                    unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             63456                63456                processes
Max open files            40000                40000                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       63456                63456                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: core
 
Kernel version: Linux version 3.10.0-1160.62.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Tue Apr 5 16:57:59 UTC 2022



 Comments   
Comment by Marko Mäkelä [ 2022-08-22 ]

nunogato, can you please try to produce a full stack trace for the crash? You should install the MariaDB-server-debuginfo-10.6.9-1.el7 package first.

Comment by Thirunarayanan Balathandayuthapani [ 2022-08-22 ]

Previously, If there is a duplicate key happened due to FTS_DOC_ID(MDEV-15237) then only error message will happen in log file and it doesn't crash. But MDEV-25581 removes the background sync operation and allows user thread to do sync operation during transaction commit. It leads to crash. It is not a good idea to upgrade to 10.6.9 by those who're affected by MDEV-15237. Internally, we fail to repeat the MDEV-15237 problem, it would be great to get a test case from any affected user.

Comment by Marko Mäkelä [ 2022-09-07 ]

MDEV-29342 has been fixed in the 10.6 branch. Is this a duplicate of it? We need a stack trace to confirm it.

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