Skip to content

Commit 0ef5e3b

Browse files
committed
replication: fix crash on access to a not yet ready relay
All the code outside of relay.cc judges about relay's liveliness looking only at relay state. When relay->state is RELAY_FOLLOW, the relay is considered operational. This is not always true: for example, both relay_push_raft() and relay_trigger_vclock_sync() are only possible after relay thread pairs with tx via the cbus. This happens **after** the relay enters RELAY_FOLLOW state. Fix the possible access to uninitialized cpipe by relay_trigger_vclock_sync(): make it a nop until the relay is paired with tx. Closes tarantool#7991 NO_DOC=bugfix NO_TEST=covered by replication-luatest/linearizable_test.lua
1 parent b787f32 commit 0ef5e3b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## bugfix/replication
2+
3+
* Fixed a crash when using transactions with the linearizable isolation level during
4+
a replica reconnect (gh-7991).

src/box/relay.cc

+2
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,8 @@ int
902902
relay_trigger_vclock_sync(struct relay *relay, uint64_t *vclock_sync,
903903
double deadline)
904904
{
905+
if (!relay->tx.is_paired)
906+
return 0;
905907
struct relay_trigger_vclock_sync_msg *msg =
906908
(struct relay_trigger_vclock_sync_msg *)xmalloc(sizeof(*msg));
907909
msg->relay = relay;

0 commit comments

Comments
 (0)