[Tarantool-patches] [PATCH 06/11] swim: fix zero division
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Fri Jun 5 02:43:13 MSK 2020
If swim_cfg() fails during first configuration after the self
member is created, it is deleted before return. Deletion of the
member causes member update event addition to the dissemination
queue. The event TTL depends on log2(member count), where the
count is zero in the described situation. This leads to zero
division according to clang sanitizer.
The patch makes member deletion from the member table happen a
little later, so the member event registration can't ever see the
table empty.
Part of #4609
---
src/lib/swim/swim.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
index 9a7b4ce85..396bd7c45 100644
--- a/src/lib/swim/swim.c
+++ b/src/lib/swim/swim.c
@@ -874,11 +874,6 @@ swim_delete_member(struct swim *swim, struct swim_member *member)
{
say_verbose("SWIM %d: member %s is deleted", swim_fd(swim),
tt_uuid_str(&member->uuid));
- struct mh_swim_table_key key = {member->hash, &member->uuid};
- mh_int_t rc = mh_swim_table_find(swim->members, key, NULL);
- assert(rc != mh_end(swim->members));
- mh_swim_table_del(swim->members, rc, NULL);
- rlist_del_entry(member, in_round_queue);
/* Failure detection component. */
if (! heap_node_is_stray(&member->in_wait_ack_heap))
@@ -888,6 +883,11 @@ swim_delete_member(struct swim *swim, struct swim_member *member)
swim_on_member_update(swim, member, SWIM_EV_DROP);
rlist_del_entry(member, in_dissemination_queue);
+ struct mh_swim_table_key key = {member->hash, &member->uuid};
+ mh_int_t rc = mh_swim_table_find(swim->members, key, NULL);
+ assert(rc != mh_end(swim->members));
+ mh_swim_table_del(swim->members, rc, NULL);
+ rlist_del_entry(member, in_round_queue);
swim_member_delete(member);
}
--
2.21.1 (Apple Git-122.3)
More information about the Tarantool-patches
mailing list