Skip to content

Fix the bug that consul is always in the leaving state#663

Open
yangjunmyfm192085 wants to merge 1 commit into
hashicorp:masterfrom
yangjunmyfm192085:fixleavingstatus
Open

Fix the bug that consul is always in the leaving state#663
yangjunmyfm192085 wants to merge 1 commit into
hashicorp:masterfrom
yangjunmyfm192085:fixleavingstatus

Conversation

@yangjunmyfm192085

Copy link
Copy Markdown

Fix: #662
The function handleNodeJoin is used to set member.Status = StatusAlive, and the function handleNodeJoinIntent is used to set member.statusLTime = joinMsg.LTime.
Unfortunately, the two are not in sync. If set member.statusLTime directly in handleNodeJoinIntent, will get wrong results. As a result, the member state we see has always been leaving
e.g.
We have 3 members A B and C in our cluster, Both B and C join the cluster through A.

  • We do leave and start operations on node B
  • When node A updates member.statusLTime of B to the latest value in the function handleNodeJoinIntent, member.Status may still be left.
  • When A sends its member status to C through pushPullMsg, C recognizes that the status of B is leave and marks member .statusLTime is the received value + 1 incorrectly.
  • C refreshes the status of member B as leaving, and marks member.statusLTime as member.statusLTime as the received value +1
  • The state of B in C continues to be leaving eventually

@hashicorp-cla

hashicorp-cla commented Sep 21, 2022

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chymy

chymy commented Sep 21, 2022

Copy link
Copy Markdown

/lgtm

@chymy

chymy commented Sep 21, 2022

Copy link
Copy Markdown

/assign @rboyer

@yangjunmyfm192085 yangjunmyfm192085 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @rboyer

@kemko

kemko commented Feb 8, 2024

Copy link
Copy Markdown

@rboyer ?...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When the nodes leave and start at the same time in a large-capacity consul cluster, some member states will continue to keep leaving, not alive.

4 participants