Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Intermittent Kafka Quorum Formation Issue #122

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

see-quick
Copy link
Member

@see-quick see-quick commented Dec 2, 2024

This PR addresses an intermittent issue where Kafka brokers fail to form a quorum due to mismatched voter keys in the Raft consensus algorithm. The problem occurs approximately 1 out of every 5 test runs (which I tried)...

Brokers occasionally fail to form a quorum, with logs showing repeated messages like:

Leader sent a voter key... that doesn't match the local key...; returning INVALID_VOTER_KEY

The advertised listeners for the CONTROLLER listener are set to localhost (using getHost() method), while controller.quorum. voters specify hostnames like broker-0, broker-1, etc. This mismatch leads to brokers advertising their controller endpoints incorrectly, causing other brokers to attempt connections to localhost instead of the correct broker addresses.

Using localhost for the CONTROLLER listener causes brokers to incorrectly attempt to connect to themselves rather than the intended broker, due to localhost resolving to 127.0.0.1.

I have verified such a change in a test case which failed once in 5 runs and now it's working (20 runs without any issue):

image

Signed-off-by: see-quick <maros.orsak159@gmail.com>
Signed-off-by: see-quick <maros.orsak159@gmail.com>
@see-quick see-quick added this to the 0.110.0 milestone Dec 2, 2024
@see-quick see-quick requested a review from a team December 2, 2024 12:43
@see-quick see-quick self-assigned this Dec 2, 2024
@see-quick see-quick linked an issue Dec 2, 2024 that may be closed by this pull request
Signed-off-by: see-quick <maros.orsak159@gmail.com>
Copy link
Member

@showuon showuon left a comment

Choose a reason for hiding this comment

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

Nice find @see-quick ! The fix makes sense to me.

@see-quick see-quick merged commit cc69af4 into strimzi:main Dec 4, 2024
7 checks passed
see-quick added a commit to see-quick/test-container that referenced this pull request Dec 4, 2024
* Fix race condition for KRaft during multi-node setup

Signed-off-by: see-quick <maros.orsak159@gmail.com>

* remove cat

Signed-off-by: see-quick <maros.orsak159@gmail.com>

* update test

Signed-off-by: see-quick <maros.orsak159@gmail.com>

---------

Signed-off-by: see-quick <maros.orsak159@gmail.com>
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.

Possible race condition during start-up of multiple nodes with KRaft.
4 participants