[MDEV-24469] Assertion `active() == false' failed with "XA START.." Created: 2020-12-10  Updated: 2021-03-25  Resolved: 2020-12-22

Status: Closed
Project: MariaDB Server
Component/s: Galera
Affects Version/s: None
Fix Version/s: 10.4.18, 10.5.9, 10.6.0

Type: Bug Priority: Major
Reporter: Muhammad Irfan Assignee: Jan Lindström (Inactive)
Resolution: Fixed Votes: 0
Labels: galera

Attachments: File jan.test    

 Description   

Although MariaDB Galera Cluster does not support XA transactions but it still shouldn't crash server.

1. create a new db and a table
2. input a value
3. XA START 'test';

here where it crashed I received in the log

mariadbd: /home/jenkins/workspace/MariaDBE-Custom-bintar/label/rhel-7/wsrep-lib/src/transaction.cpp:123: int wsrep::transaction::start_transaction(const wsrep::transaction_id&): Assertion `active() == false' failed.
201208 13:46:06 [ERROR] 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.4.15-9-MariaDB-enterprise-log
key_buffer_size=134217728
read_buffer_size=131072
max_used_connections=6
max_threads=1002
thread_count=15
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 2336198 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x7f2a980008c8
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 = 0x7f2a0c3accc0 thread_stack 0x49000
/MARIADB/MIN10020/bin/mariadb/bin/mariadbd(my_print_stacktrace+0x2e)[0x55ec5d1cc0be]
/MARIADB/MIN10020/bin/mariadb/bin/mariadbd(handle_fatal_signal+0x30f)[0x55ec5cc4ca1f]
sigaction.c:0(__restore_rt)[0x7f2d85aaa630]
:0(__GI_raise)[0x7f2d83d27387]
:0(__GI_abort)[0x7f2d83d28a78]
:0(__assert_fail_base)[0x7f2d83d201a6]
:0(__GI___assert_fail)[0x7f2d83d20252]
/MARIADB/MIN10020/bin/mariadb/bin/mariadbd(+0xeedd5e)[0x55ec5d26dd5e]
/MARIADB/MIN10020/bin/mariadb/bin/mariadbd(_Z11trans_beginP3THDj+0x2eb)[0x55ec5cb3a56b]
src/transaction.cpp:123(wsrep::transaction::start_transaction(wsrep::transaction_id const&))[0x55ec5cbce18e]
wsrep/client_state.hpp:290(wsrep::client_state::start_transaction(wsrep::transaction_id const&))[0x55ec5ca3e5c5]
sql/xa.cc:440(trans_xa_start(THD*))[0x55ec5ca44ddd]
sql/sql_parse.cc:5970(mysql_execute_command(THD*))[0x55ec5c92ec6c]
sql/sql_parse.cc:7926(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55ec5ca48757]
sql/sql_parse.cc:1353(do_command(THD*))[0x55ec5ca48c19]
sql/sql_connect.cc:1412(do_handle_one_connection(CONNECT*))[0x55ec5cb2b9fa]
sql/sql_connect.cc:1318(handle_one_connection)[0x55ec5cb2badd]
perfschema/pfs.cc:1872(pfs_spawn_thread)[0x55ec5d17d81d]
pthread_create.c:0(start_thread)[0x7f2d85aa2ea5]
/lib64/libc.so.6(clone+0x6d)[0x7f2d83def8dd]
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f2a9802c050): XA START 'test'
Connection ID (thread ID): 205
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
 
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 /MARIADB/MIN10020/data
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             15711                15711                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       15711                15711                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



 Comments   
Comment by Jan Lindström (Inactive) [ 2020-12-14 ]

Currently using XA-transactions could cause whole cluster to either crash or go to inconsistent state. We could refuse all XA-transactions from user, however there are some internal usage of XA that can't be at the moment refused.

Comment by Jan Lindström (Inactive) [ 2020-12-18 ]

I can repeat crash but different assertion. In my opinion this should not crash. Assertions like this should inform us what is actual state() value.

(gdb) where
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1  0x00007ffff7540864 in __GI_abort () at abort.c:79
#2  0x00007ffff7540749 in __assert_fail_base (fmt=0x7ffff76cc458 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555556f77250 "state() == s_executing || state() == s_prepared || state() == s_committed || state() == s_aborted || state() == s_must_abort || state() == s_cert_failed || state() == s_must_replay", file=0x555556f76348 "/home/jan/mysql/10.4-bugs/wsrep-lib/src/transaction.cpp", line=810, function=<optimized out>) at assert.c:92
#3  0x00007ffff7552a96 in __GI___assert_fail (assertion=0x555556f77250 "state() == s_executing || state() == s_prepared || state() == s_committed || state() == s_aborted || state() == s_must_abort || state() == s_cert_failed || state() == s_must_replay", file=0x555556f76348 "/home/jan/mysql/10.4-bugs/wsrep-lib/src/transaction.cpp", line=810, function=0x555556f77220 "int wsrep::transaction::after_statement()") at assert.c:101
#4  0x0000555556a2d0e8 in wsrep::transaction::after_statement (this=0x7fff78006fa0) at /home/jan/mysql/10.4-bugs/wsrep-lib/src/transaction.cpp:810
#5  0x0000555556a15368 in wsrep::client_state::after_statement (this=0x7fff78006f38) at /home/jan/mysql/10.4-bugs/wsrep-lib/src/client_state.cpp:257
#6  0x0000555555d79601 in wsrep_after_statement (thd=0x7fff78000d90) at /home/jan/mysql/10.4-bugs/sql/wsrep_trans_observer.h:396
#7  0x0000555555d916a6 in wsrep_mysql_parse (thd=0x7fff78000d90, rawbuf=0x7fff78012128 "XA PREPARE 'test'", length=17, parser_state=0x7fffe8088430, is_com_multi=false, is_next_command=false) at /home/jan/mysql/10.4-bugs/sql/sql_parse.cc:7770
#8  0x0000555555d7e0d2 in dispatch_command (command=COM_QUERY, thd=0x7fff78000d90, packet=0x7fff780087b1 "XA PREPARE 'test'", packet_length=17, is_com_multi=false, is_next_command=false) at /home/jan/mysql/10.4-bugs/sql/sql_parse.cc:1825
#9  0x0000555555d7ca3f in do_command (thd=0x7fff78000d90) at /home/jan/mysql/10.4-bugs/sql/sql_parse.cc:1357
#10 0x0000555555f0b933 in do_handle_one_connection (connect=0x555558341d50) at /home/jan/mysql/10.4-bugs/sql/sql_connect.cc:1412
#11 0x0000555555f0b67c in handle_one_connection (arg=0x555558341d50) at /home/jan/mysql/10.4-bugs/sql/sql_connect.cc:1316
#12 0x000055555692bc3a in pfs_spawn_thread (arg=0x5555584040c0) at /home/jan/mysql/10.4-bugs/storage/perfschema/pfs.cc:1869
#13 0x00007ffff7e85590 in start_thread (arg=0x7fffe8089640) at pthread_create.c:463
#14 0x00007ffff7633223 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) up
#1  0x00007ffff7540864 in __GI_abort () at abort.c:79
(gdb) 
#2  0x00007ffff7540749 in __assert_fail_base (fmt=0x7ffff76cc458 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x555556f77250 "state() == s_executing || state() == s_prepared || state() == s_committed || state() == s_aborted || state() == s_must_abort || state() == s_cert_failed || state() == s_must_replay", file=0x555556f76348 "/home/jan/mysql/10.4-bugs/wsrep-lib/src/transaction.cpp", line=810, function=<optimized out>) at assert.c:92
(gdb) 
#3  0x00007ffff7552a96 in __GI___assert_fail (assertion=0x555556f77250 "state() == s_executing || state() == s_prepared || state() == s_committed || state() == s_aborted || state() == s_must_abort || state() == s_cert_failed || state() == s_must_replay", file=0x555556f76348 "/home/jan/mysql/10.4-bugs/wsrep-lib/src/transaction.cpp", line=810, function=0x555556f77220 "int wsrep::transaction::after_statement()") at assert.c:101
(gdb) 
#4  0x0000555556a2d0e8 in wsrep::transaction::after_statement (this=0x7fff78006fa0) at /home/jan/mysql/10.4-bugs/wsrep-lib/src/transaction.cpp:810
(gdb) p state_
$1 = wsrep::transaction::s_committing
(gdb) 

Generated at Thu Feb 08 09:30:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.