Repository navigation
kafka: Give the empty topic consumer longer if it needs it - #1698
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 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
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>
phlax
force-pushed
the
fix-stress-kafka
branch
from
November 29, 2026 21:39
b6c49e7 to
76ae8c9
Compare
phlax
marked this pull request as ready for review
November 29, 2026 21:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

In the stress job, with every container limited to a quarter of a CPU,
kafkafailed on all three passes:The test consumes from an empty topic with
--timeout-ms 5000and then expects Envoy'sfetch_requestcount 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.shas #1672, so whichever lands second will need rebasing.