Skip to content
/ server Public

Commit bb32ace

Browse files
committed
MDEV-37354 : SIGSEGV in Wsrep_server_service::release_high_priority_service | discard_streaming_applier
This issue seems to be already fixed. However, to avoid future problems: Wsrep_server_service::release_storage_service Add assertion that storage service is not nullptr and contains thd. In production binaries add guard to not use nullptr. Wsrep_server_service::release_high_priority_service Add assertion that high_priority service is not nullptr and contains thd. In production binaries add guard to not use nullptr. wsrep_is_BF_lock_timeout Remove printing of record lock because its page might not be latched leading to assertion in multi-master testing.
1 parent 4ee491f commit bb32ace

File tree

4 files changed

+46
-30
lines changed

4 files changed

+46
-30
lines changed

mysql-test/suite/galera/r/galera_mdev_31517.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
connection node_2;
22
connection node_1;
3+
# Make sure that the test is operating on the right version of galera library.
4+
# Correct Galera library found
5+
connection node_1;
6+
connection node_2;
37
connection node_2;
48
CALL mtr.add_suppression("unknown variable 'non_existing_variable=ON'");
59
CALL mtr.add_suppression("Aborting");

mysql-test/suite/galera/t/galera_mdev_31517.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
--let $galera_version=26.4.25
2525
source ../wsrep/include/check_galera_version.inc;
2626

27+
# Save original auto_increment_offset values.
28+
--let $node_1=node_1
29+
--let $node_2=node_2
30+
--source include/auto_increment_offset_save.inc
31+
2732
# Suppress expected errors and warnings:
2833
--connection node_2
2934
CALL mtr.add_suppression("unknown variable 'non_existing_variable=ON'");
@@ -129,4 +134,5 @@ DROP TABLE t;
129134
EOF
130135
--remove_file $TEST_LOG.copy
131136

137+
--source include/auto_increment_offset_restore.inc
132138
--source include/galera_end.inc

sql/wsrep_server_service.cc

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,22 @@ void Wsrep_server_service::release_storage_service(
8080
{
8181
Wsrep_storage_service* ss=
8282
static_cast<Wsrep_storage_service*>(storage_service);
83-
THD* thd= ss->m_thd;
84-
wsrep_reset_threadvars(thd);
85-
server_threads.erase(thd);
86-
delete ss;
87-
delete thd;
83+
DBUG_ASSERT(ss && ss->m_thd);
84+
85+
// Do not crash server on production
86+
if (ss)
87+
{
88+
THD* thd= ss->m_thd;
89+
if (thd)
90+
{
91+
wsrep_reset_threadvars(thd);
92+
server_threads.erase(thd);
93+
delete ss;
94+
delete thd;
95+
}
96+
else
97+
delete ss;
98+
}
8899
}
89100

90101
Wsrep_applier_service*
@@ -141,12 +152,23 @@ void Wsrep_server_service::release_high_priority_service(wsrep::high_priority_se
141152
{
142153
Wsrep_high_priority_service* hps=
143154
static_cast<Wsrep_high_priority_service*>(high_priority_service);
144-
THD* thd= hps->m_thd;
145-
delete hps;
146-
wsrep_store_threadvars(thd);
147-
server_threads.erase(thd);
148-
delete thd;
149-
wsrep_delete_threadvars();
155+
DBUG_ASSERT(hps && hps->m_thd);
156+
157+
// Do not crash server on production
158+
if (hps)
159+
{
160+
THD* thd= hps->m_thd;
161+
if (thd)
162+
{
163+
delete hps;
164+
wsrep_store_threadvars(thd);
165+
server_threads.erase(thd);
166+
delete thd;
167+
wsrep_delete_threadvars();
168+
}
169+
else
170+
delete hps;
171+
}
150172
}
151173

152174
void Wsrep_server_service::background_rollback(

storage/innobase/lock/lock0lock.cc

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -670,25 +670,9 @@ bool wsrep_is_BF_lock_timeout(const trx_t &trx)
670670
<< " error: " << trx.error_state
671671
<< " query: " << wsrep_thd_query(trx.mysql_thd);
672672

673-
if (const lock_t*wait_lock = trx.lock.wait_lock)
674-
{
675-
const my_hrtime_t now= my_hrtime_coarse();
676-
const my_hrtime_t suspend_time= trx.lock.suspend_time;
677-
fprintf(stderr,
678-
"------- TRX HAS BEEN WAITING %llu us"
679-
" FOR THIS LOCK TO BE GRANTED:\n",
680-
now.val - suspend_time.val);
681-
682-
if (!wait_lock->is_table()) {
683-
mtr_t mtr;
684-
lock_rec_print(stderr, wait_lock, mtr);
685-
} else {
686-
lock_table_print(stderr, wait_lock);
687-
}
688-
689-
fprintf(stderr, "------------------\n");
690-
}
691-
673+
// TODO: Can't use lock_rec_print from here because
674+
// record lock page might not be latched and we are
675+
// actually only interested lock information.
692676
return true;
693677
}
694678

0 commit comments

Comments
 (0)