[MDEV-22223] Server crashes in gu::Mutex::lock / galera::TrxHandleMaster::lock or Assertion `state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed Created: 2020-04-11  Updated: 2020-07-31  Resolved: 2020-07-31

Status: Closed
Project: MariaDB Server
Component/s: Galera, wsrep
Affects Version/s: 10.4, 10.5
Fix Version/s: 10.4.14, 10.5.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Stepan Patryshev (Inactive)
Resolution: Fixed Votes: 1
Labels: None
Environment:

Galera 26.4.4(r4599)


Issue Links:
Relates
relates to MDEV-23025 int wsrep::transaction::before_rollba... Closed
relates to MDEV-18935 Galera test mysql-wsrep#198 sporaric ... Closed
relates to MDEV-22222 Assertion `state() == s_executing || ... Closed

 Description   

Note: The test case and the debug assertion are similar (but not identical) to MDEV-22222, however this one also fails on a non-debug build.

--source include/galera_cluster.inc
 
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
LOCK TABLES t1 READ;
 
# Cleanup
UNLOCK TABLES;
DROP TABLE t1;

10.4 non-debug ba679ae52

#3  <signal handler called>
#4  __GI___pthread_mutex_lock (mutex=mutex@entry=0x70) at ../nptl/pthread_mutex_lock.c:67
#5  0x00007f19ce605e7d in gu::Mutex::lock (this=0x70) at galerautils/src/gu_mutex.hpp:50
#6  galera::TrxHandleMaster::lock (this=0x0) at galera/src/trx_handle.hpp:826
#7  galera::TrxHandleLock::TrxHandleLock (trx=..., this=0x7f19c45dd2e0) at galera/src/trx_handle.hpp:1121
#8  galera_replay_trx (gh=<optimized out>, trx_handle=<optimized out>, recv_ctx=0x7f19c45dd6e0) at galera/src/wsrep_provider.cpp:310
#9  0x0000559822fa8af8 in wsrep::wsrep_provider_v26::replay (this=<optimized out>, ws_handle=..., reply_service=<optimized out>) at /data/src/10.4/wsrep-lib/src/wsrep_provider_v26.cpp:198
#10 0x00005598229eb032 in Wsrep_client_service::replay (this=<optimized out>) at /data/src/10.4/wsrep-lib/include/wsrep/transaction.hpp:219
#11 0x0000559822fa5c86 in wsrep::transaction::replay (this=0x7f195c006bc8, lock=...) at /data/src/10.4/wsrep-lib/src/transaction.cpp:1703
#12 0x0000559822fa6c93 in wsrep::transaction::after_statement (this=this@entry=0x7f195c006bc8) at /data/src/10.4/wsrep-lib/src/transaction.cpp:816
#13 0x0000559822f89331 in wsrep::client_state::after_statement (this=this@entry=0x7f195c006b60) at /data/src/10.4/wsrep-lib/src/client_state.cpp:248
#14 0x000055982289b969 in wsrep_after_statement (thd=0x7f195c000c08) at /data/src/10.4/sql/sql_class.h:4900
#15 wsrep_mysql_parse (thd=0x7f195c000c08, rawbuf=0x7f195c00ffb0 "LOCK TABLES t1 READ", length=19, parser_state=0x7f19c45de190, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.4/sql/sql_parse.cc:7734
#16 0x000055982289e0c1 in dispatch_command (command=COM_QUERY, thd=0x7f195c000c08, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.4/sql/sql_class.h:1168
#17 0x000055982289e9df in do_command (thd=0x7f195c000c08) at /data/src/10.4/sql/sql_parse.cc:1359
#18 0x00005598229728f4 in do_handle_one_connection (connect=connect@entry=0x559824b5d538) at /data/src/10.4/sql/sql_connect.cc:1412
#19 0x00005598229729e4 in handle_one_connection (arg=arg@entry=0x559824b5d538) at /data/src/10.4/sql/sql_connect.cc:1316
#20 0x0000559822ecc2bf in pfs_spawn_thread (arg=0x5598247b6328) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#21 0x00007f19d3b1bfa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
#22 0x00007f19d336a4cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

10.4 debug edc3899d

mysqld: /data/src/10.4/wsrep-lib/src/transaction.cpp:419: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.
200412  0:50:23 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fcd089f9102 in __GI___assert_fail (assertion=0x55b99987b3e0 "state() == s_executing || state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying", file=0x55b99987a6c0 "/data/src/10.4/wsrep-lib/src/transaction.cpp", line=419, function=0x55b99987ed60 <wsrep::transaction::before_commit()::__PRETTY_FUNCTION__> "int wsrep::transaction::before_commit()") at assert.c:101
#8  0x000055b998cf54e3 in wsrep::transaction::before_commit (this=0x62b000110470) at /data/src/10.4/wsrep-lib/src/transaction.cpp:415
#9  0x000055b99757d42a in wsrep::client_state::before_commit (this=0x62b000110408) at /data/src/10.4/wsrep-lib/include/wsrep/client_state.hpp:472
#10 0x000055b99779c9c7 in wsrep_before_commit (thd=0x62b00010a270, all=false) at /data/src/10.4/sql/wsrep_trans_observer.h:271
#11 0x000055b9977a5651 in ha_commit_trans (thd=0x62b00010a270, all=false) at /data/src/10.4/sql/handler.cc:1557
#12 0x000055b9973c8482 in trans_commit_stmt (thd=0x62b00010a270) at /data/src/10.4/sql/transaction.cc:436
#13 0x000055b996fd8c6e in mysql_execute_command (thd=0x62b00010a270) at /data/src/10.4/sql/sql_parse.cc:6158
#14 0x000055b996fe446a in mysql_parse (thd=0x62b00010a270, rawbuf=0x62b000111290 "LOCK TABLES t1 READ", length=19, parser_state=0x7fcced10a5d0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
#15 0x000055b996fe2eba in wsrep_mysql_parse (thd=0x62b00010a270, rawbuf=0x62b000111290 "LOCK TABLES t1 READ", length=19, parser_state=0x7fcced10a5d0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7704
#16 0x000055b996fb90b0 in dispatch_command (command=COM_QUERY, thd=0x62b00010a270, packet=0x6290002fd271 "LOCK TABLES t1 READ", packet_length=19, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1827
#17 0x000055b996fb5a88 in do_command (thd=0x62b00010a270) at /data/src/10.4/sql/sql_parse.cc:1359
#18 0x000055b99738ddc4 in do_handle_one_connection (connect=0x61100006f4b0) at /data/src/10.4/sql/sql_connect.cc:1412
#19 0x000055b99738d666 in handle_one_connection (arg=0x61100006f4b0) at /data/src/10.4/sql/sql_connect.cc:1316
#20 0x000055b9989cb531 in pfs_spawn_thread (arg=0x61600007ecf0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
#21 0x00007fcd09273fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
#22 0x00007fcd08ac24cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Reproducible on 10.4, 10.5.
Not reproducible on 10.3.



 Comments   
Comment by Mario Karuza (Inactive) [ 2020-06-29 ]

Fixed with MDEV-22222 PR - https://github.com/MariaDB/server/pull/1613

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