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

KAFKA-18418: Use CDL to block the thread termination to avoid flaky tests #18418

Merged
merged 5 commits into from
Jan 9, 2025

Conversation

aoli-al
Copy link
Contributor

@aoli-al aoli-al commented Jan 7, 2025

More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.

This PR fixes KAFKA-18418. KafkaStreamsTest uses Thread.sleep to prevent threads from terminating. This introduces flaky tests if the sleep duration is not long enough. This patch fixes the issue by replacing the Thread.sleep with a CountDownLatch. The CountDownLatch will be released after assertions are validated.

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

I tested the proposed fix against the patch: aoli-al@aced4f1 and verified that all tests have passed. I also tested the new code using Fray (the tool that found the bug), and Fray did not report any bug using the POS strategy after 10 minutes.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@github-actions github-actions bot added triage PRs from the community streams tests Test fixes (including flaky tests) small Small PRs labels Jan 7, 2025
@github-actions github-actions bot removed the triage PRs from the community label Jan 8, 2025
Copy link
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

Overall LGTM. One nit.

@mjsax mjsax merged commit ebe7dd2 into apache:trunk Jan 9, 2025
9 checks passed
@mjsax
Copy link
Member

mjsax commented Jan 9, 2025

Thanks for the fix. Merged to trunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-approved small Small PRs streams tests Test fixes (including flaky tests)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants