[MDEV-29271] Assertion `transaction_.state() == wsrep::transaction::s_aborted' failed in int wsrep::client_state::after_statement() Created: 2022-08-08  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Galera
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Major
Reporter: Ramesh Sivaraman Assignee: Seppo Jaakola
Resolution: Unresolved Votes: 0
Labels: debug

Attachments: Text File bt_all.txt    

 Description   

The crash is from galera multi-thread pquery run.

10.10.0 c360eadb8c92624419b94ec0601ebf3e6bb64374

mysqld: /test/mtest/10.10/wsrep-lib/src/client_state.cpp:267: int wsrep::client_state::after_statement(): Assertion `transaction_.state() == wsrep::transaction::s_aborted' failed.

10.10.0 c360eadb8c92624419b94ec0601ebf3e6bb64374

Core was generated by `/test/mtest/10.10/mariadb-10.10.0-linux-x86_64/bin/mysqld --defaults-file=/dev/'.
Program terminated with signal SIGABRT, Aborted.
#0  0x0000000070000002 in ?? ()
[Current thread is 1 (Thread 0x455e1eab5700 (LWP 2138686))]
(gdb) bt
#0  0x0000000070000002 in ?? ()
#1  0x0000348b734211a4 in _raw_syscall () at /home/roc/rr/rr/src/preload/raw_syscall.S:120
#2  0x0000348b7341c2ce in traced_raw_syscall (call=<optimized out>) at /home/roc/rr/rr/src/preload/syscallbuf.c:278
#3  0x0000348b734200d3 in syscall_hook_internal (call=0x152525ad3fa0) at /home/roc/rr/rr/src/preload/syscallbuf.c:3420
#4  syscall_hook (call=0x152525ad3fa0) at /home/roc/rr/rr/src/preload/syscallbuf.c:3454
#5  0x0000348b7341c0b0 in _syscall_hook_trampoline () at /home/roc/rr/rr/src/preload/syscall_hook.S:313
#6  0x0000348b7341c10f in __morestack () at /home/roc/rr/rr/src/preload/syscall_hook.S:458
#7  0x0000348b7341c169 in _syscall_hook_trampoline_89_c2_f7_da () at /home/roc/rr/rr/src/preload/syscall_hook.S:512
#8  0x000022d158df7f0c in __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#9  0x00005652a2c20e7a in my_write_core (sig=6) at /test/mtest/10.10/mysys/stacktrace.c:424
#10 0x00005652a2375443 in handle_fatal_signal (sig=6) at /test/mtest/10.10/sql/signal_handler.cc:345
#11 <signal handler called>
#12 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#13 0x00007e852684b859 in __GI_abort () at abort.c:79
#14 0x00007e852684b729 in __assert_fail_base (fmt=0x7e85269e1588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5652a3307e80 "transaction_.state() == wsrep::transaction::s_aborted", file=0x5652a3307b38 "/test/mtest/10.10/wsrep-lib/src/client_state.cpp", line=267, function=<optimized out>) at assert.c:92
#15 0x00007e852685cf36 in __GI___assert_fail (assertion=0x5652a3307e80 "transaction_.state() == wsrep::transaction::s_aborted", file=0x5652a3307b38 "/test/mtest/10.10/wsrep-lib/src/client_state.cpp", line=267, function=0x5652a33080d0 "int wsrep::client_state::after_statement()") at assert.c:101
#16 0x00005652a2cd695d in wsrep::client_state::after_statement (this=0x2eb92c008930) at /test/mtest/10.10/wsrep-lib/src/client_state.cpp:267
#17 0x00005652a1f9f8ae in wsrep_after_statement (thd=0x2eb92c002098) at /test/mtest/10.10/sql/wsrep_trans_observer.h:441
#18 0x00005652a1fb7667 in wsrep_mysql_parse (thd=0x2eb92c002098, rawbuf=0x2eb92c0151b0 "INSERT INTO t1  VALUES(1)", length=25, parser_state=0x455e1eab4480) at /test/mtest/10.10/sql/sql_parse.cc:7879
#19 0x00005652a1fa410a in dispatch_command (command=COM_QUERY, thd=0x2eb92c002098, packet=0x2eb92c00cbb9 "INSERT INTO t1  VALUES(1);", packet_length=26, blocking=true) at /test/mtest/10.10/sql/sql_parse.cc:1881
#20 0x00005652a1fa2bd0 in do_command (thd=0x2eb92c002098, blocking=true) at /test/mtest/10.10/sql/sql_parse.cc:1407
#21 0x00005652a2180fa5 in do_handle_one_connection (connect=0x495d0c63ab38, put_in_cache=true) at /test/mtest/10.10/sql/sql_connect.cc:1418
#22 0x00005652a2180c35 in handle_one_connection (arg=0x495d0c63ab38) at /test/mtest/10.10/sql/sql_connect.cc:1312
#23 0x00005652a2697025 in pfs_spawn_thread (arg=0x495d0c63ac18) at /test/mtest/10.10/storage/perfschema/pfs.cc:2201
#24 0x000022d158def609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#25 0x00007e8526948293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



 Comments   
Comment by Ramesh Sivaraman [ 2023-03-02 ]

Reduced test case.

CREATE TABLE t (a INT);
SET SESSION max_session_mem_used=1;
SET GLOBAL wsrep_on=OFF;
XA START 'a';
SET SESSION query_prealloc_size=1;
LOAD INDEX INTO CACHE t PARTITION (p,p0) IGNORE LEAVES;
SET GLOBAL wsrep_on=ON;
SET GLOBAL wsrep_max_ws_rows=1;
SET @@max_session_mem_used=DEFAULT;
SET SESSION wsrep_trx_fragment_size=1;
INSERT INTO t VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);

Leads to

10.6.13 3e2ad0e918d5d38322994ec9e08fc5dda3a80707 (Debug)

mysqld: /test/10.6_dbg/wsrep-lib/src/client_state.cpp:270: int wsrep::client_state::after_statement(): Assertion `transaction_.state() == wsrep::transaction::s_aborted' failed.

10.6.13 3e2ad0e918d5d38322994ec9e08fc5dda3a80707 (Debug)

Core was generated by `/test/GAL_MD010323-mariadb-10.6.13-linux-x86_64-dbg/bin/mysqld --defaults-file='.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
[Current thread is 1 (Thread 0x151138106700 (LWP 2783432))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
#1  0x000055fca5684712 in my_write_core (sig=sig@entry=6) at /test/10.6_dbg/mysys/stacktrace.c:424
#2  0x000055fca4f3762f in handle_fatal_signal (sig=6) at /test/10.6_dbg/sql/signal_handler.cc:357
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x000015116e19a859 in __GI_abort () at abort.c:79
#6  0x000015116e19a729 in __assert_fail_base (fmt=0x15116e330588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55fca5d595d8 "transaction_.state() == wsrep::transaction::s_aborted", file=0x55fca5d59298 "/test/10.6_dbg/wsrep-lib/src/client_state.cpp", line=270, function=<optimized out>) at assert.c:92
#7  0x000015116e1abfd6 in __GI___assert_fail (assertion=assertion@entry=0x55fca5d595d8 "transaction_.state() == wsrep::transaction::s_aborted", file=file@entry=0x55fca5d59298 "/test/10.6_dbg/wsrep-lib/src/client_state.cpp", line=line@entry=270, function=function@entry=0x55fca5d59548 "int wsrep::client_state::after_statement()") at assert.c:101
#8  0x000055fca57ca9bf in wsrep::client_state::after_statement (this=this@entry=0x1510fc0072d8) at /test/10.6_dbg/wsrep-lib/src/client_state.cpp:276
#9  0x000055fca4c7070b in wsrep_after_statement (thd=0x1510fc000d48) at /test/10.6_dbg/sql/sql_class.h:5454
#10 wsrep_mysql_parse (thd=thd@entry=0x1510fc000d48, rawbuf=0x1510fc01ea90 "INSERT INTO t VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)", length=60, parser_state=parser_state@entry=0x151138105310) at /test/10.6_dbg/sql/sql_parse.cc:7863
#11 0x000055fca4c7e654 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x1510fc000d48, packet=packet@entry=0x1510fc00ac79 "INSERT INTO t VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)", packet_length=packet_length@entry=60, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1388
#12 0x000055fca4c80a80 in do_command (thd=0x1510fc000d48, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1409
#13 0x000055fca4dc5f72 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55fca738d408, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1416
#14 0x000055fca4dc6444 in handle_one_connection (arg=0x55fca738d408) at /test/10.6_dbg/sql/sql_connect.cc:1318
#15 0x000015116e6ab609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#16 0x000015116e297133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.29 (dbg), 10.5.20 (dbg), 10.6.13 (dbg),10.7.8 (dbg), 10.8.8 (dbg), 10.9.6 (dbg), 10.10.4 (dbg), 10.11.3 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.4.29 (opt), 10.5.20 (opt), 10.6.12 (opt), 10.7.8 (opt), 10.8.8 (opt), 10.9.6 (opt), 10.10.4 (opt), 10.11.3 (opt)

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