Skip to content

KAFKA-8073: Fix flaky BaseQuotaTest.testThrottledProducerConsumer#22338

Open
nileshkumar3 wants to merge 2 commits into
apache:trunkfrom
nileshkumar3:KAFKA-8073
Open

KAFKA-8073: Fix flaky BaseQuotaTest.testThrottledProducerConsumer#22338
nileshkumar3 wants to merge 2 commits into
apache:trunkfrom
nileshkumar3:KAFKA-8073

Conversation

@nileshkumar3
Copy link
Copy Markdown
Contributor

Ref: https://issues.apache.org/jira/browse/KAFKA-8073

Causes

  1. produceUntilThrottled sent tiny payloads, so on slow hosts the
    1000 sends could stay under the 8000 B/s producer quota and never
    trigger a throttle.
  2. The broker throttle-time metric was cached once before the send
    loop, so the lazily-registered sensor could be missed.
  3. verifyThrottleTimeRequestChannelMetric asserted on the broker
    ThrottleTimeMs histogram immediately, before the broker had
    recorded the value.

Changes

  • Use a fixed 2 KB payload in produceUntilThrottled so the quota is
    reliably exceeded.
  • Re-read the broker throttle-time metric inside the send loop.
  • Poll the RequestChannel ThrottleTimeMs via TestUtils.waitUntilTrue.

@github-actions github-actions Bot added triage PRs from the community core Kafka Broker tests Test fixes (including flaky tests) small Small PRs labels May 21, 2026
@muralibasani
Copy link
Copy Markdown
Contributor

@nileshkumar3 can you pls add some loop(may be 50) run results executed locally ? this could help if the flakiness is gone.

@nileshkumar3
Copy link
Copy Markdown
Contributor Author

@nileshkumar3 can you pls add some loop(may be 50) run results executed locally ? this could help if the flakiness is gone.
@muralibasani I ran the ClientIdQuotaTest.testThrottledProducerConsumer locally 50 times and all passed.

@github-actions
Copy link
Copy Markdown

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

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

Labels

ci-approved core Kafka Broker needs-attention small Small PRs tests Test fixes (including flaky tests) triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants