Skip to content

Conversation

@XComp
Copy link
Contributor

@XComp XComp commented Sep 1, 2022

This is a 1.15 backport of PR #20709 (no conflicts detected during cherry-pick)

CURATOR-645 covers a bug in the LeaderLatch implementation that causes a race condition if a child node, participating in the leader election, is removed too fast. This results in a different code branch being executed which triggers a reset of the LeaderLatch instead of re-collecting the children to determine the next leader.
The issue occurs because LeaderLatch#checkLeadership is not executed transactionally, i.e. retrieving the children and setting up the watcher for the predecessor is not done atomically. This leads to the race condition where a children (the previous leader's node) is removed before setting up the watcher which results in an invalid handling of the situation using reset.
Adding some sleep here (simulating the leader actually doing something) will reduce the risk of falling into the race condition because it will give the concurrently running LeaderLatch instances more time to set up the watchers properly.

This is only meant as a temporary solution until CURATOR-645 is resolved and the curator dependency on the Flink side is upgraded.

…ssues caused by CURATOR-645

CURATOR-645 covers a bug in the LeaderLatch implementation that causes a race condition if a child node, participating in the leader election, is removed too fast. This results in a different code branch being executed which triggers a reset of the LeaderLatch instead of re-collecting the children to determine the next leader.
The issue occurs because LeaderLatch#checkLeadership is not executed transactionally, i.e. retrieving the children and setting up the watcher for the predecessor is not done atomically. This leads to the race condition where a children (the previous leader's node) is removed before setting up the watcher which results in an invalid handling of the situation using reset.
Adding some sleep here (simulating the leader actually doing something) will reduce the risk of falling into the race condition because it will give the concurrently running LeaderLatch instances more time to set up the watchers properly.

This is only meant as a temporary solution until CURATOR-645 is resolved and the curator dependency on the Flink side is upgraded.
@XComp XComp changed the title [FLINK-28078][tests] Mitigate likelihood to run into test stability issues caused by CURATOR-645 [BP-1.15][tests] Mitigate likelihood to run into test stability issues caused by CURATOR-645 Sep 1, 2022
@flinkbot
Copy link
Collaborator

flinkbot commented Sep 1, 2022

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@XComp
Copy link
Contributor Author

XComp commented Sep 1, 2022

The build failure is related to FLINK-29161 and unrelated to the change of this PR.

@XComp XComp merged commit ed8700d into apache:release-1.15 Sep 1, 2022
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.

3 participants