Skip to content

kafka: Give the empty topic consumer longer if it needs it - #1698

Merged
phlax merged 1 commit into
envoyproxy:mainfrom
phlax:fix-stress-kafka
Nov 29, 2026
Merged

phlax merged 1 commit into
envoyproxy:mainfrom
phlax:fix-stress-kafka

Conversation

@phlax

@phlax phlax commented Nov 29, 2026

Copy link
Copy Markdown
Member

In the stress job, with every container limited to a quarter of a CPU, kafka failed on all three passes:

ERROR: Fetch requests did not increase (initial: 3, updated: 3)

The test consumes from an empty topic with --timeout-ms 5000 and then expects Envoy's fetch_request count to have gone up. The consumer has to start, find the coordinator and join a group before it sends a fetch, and when slowed down it times out before getting that far.

If the count has not moved the consumer is now run again with a longer timeout (15s, then 45s). A run in which 5s is enough takes no longer than it did.

Tested locally with all of the example's containers limited to 0.25 CPU: the 5s attempt timed out without a fetch, the 15s one fetched (count 3 to 23), and the example passes.

This touches the same part of kafka/verify.sh as #1672, so whichever lands second will need rebasing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The example documentation still prescribes only a 5-second attempt, omitting the conditional retries and count checks needed to avoid the same failure under CPU contention.

1 open issue
What changed in this PR

This PR makes the Kafka sandbox’s empty-topic verification more tolerant of CPU contention while preserving the existing runtime when the first attempt succeeds.

Changes:

  • Extracts fetch-request metric retrieval into a reusable helper.
  • Retries consumption with 15-second and 45-second timeouts if the initial 5-second attempt does not increase the fetch count, stopping once it does.
File Description
kafka/​verify.sh Adds conditional longer-timeout retries to the empty-topic fetch check.

Review effort: Balanced

Comment thread kafka/verify.sh Resolved
The test consumes from an empty topic for 5s and then expects Envoy to
have counted a fetch request. A consumer has to find the coordinator
and join a group before it fetches, and on a busy machine it can time
out before it gets that far: in the stress job, with containers
limited to a quarter of a CPU, the count never moved.

If the count has not moved, try again with a longer timeout. A run
where 5s is enough takes no longer than before.

Signed-off-by: Ryan Northey <ryan@synca.io>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues blocking approval of the empty-topic retry changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@phlax
phlax marked this pull request as ready for review November 29, 2026 21:46
@phlax
phlax merged commit 811ddd8 into envoyproxy:main Nov 29, 2026
8 checks passed
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.

2 participants