Skip to content

KAFKA-16630: Fix flaky classic consumer poll test#22787

Merged
lianetm merged 3 commits into
apache:trunkfrom
lianetm:lm-kafka-16630
Jul 9, 2026
Merged

KAFKA-16630: Fix flaky classic consumer poll test#22787
lianetm merged 3 commits into
apache:trunkfrom
lianetm:lm-kafka-16630

Conversation

@lianetm

@lianetm lianetm commented Jul 8, 2026

Copy link
Copy Markdown
Member

Flakiness reproduced locally, due to a single call to poll(0) that may
not be enough if the HB thread interleaves with the application thread.

In the case where HB thread removes the completion handler for the fetch
request from the queue, but before firing it (what puts the records on
the buffer), the app thread reads interleaves, no completed request
found in the queue (so it returns empty on its single poll(0) attempt)

Ensuring there is a following poll will allow to see the records (even
if it was the HB thread taking the completed request from the queue, it
will just fire completion and the next poll after that finds the records
in the buffer).

Same fix applied to 2 tests that had the same check.

Reviewers: Andrew Schofield aschofield@confluent.io, TengYao Chi
frankvicky@apache.org

@github-actions github-actions Bot added consumer tests Test fixes (including flaky tests) clients small Small PRs labels Jul 8, 2026
Comment on lines -2373 to -2374
// TODO: this test references RPCs to be sent that are not part of the CONSUMER group protocol.
// We are deferring any attempts at generalizing this test for both group protocols to the future.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is an unrelated clean up

@lianetm
lianetm merged commit 0071092 into apache:trunk Jul 9, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clients consumer small Small PRs tests Test fixes (including flaky tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants