Repository navigation
fix(compose): probe Kafka via non-JVM ApiVersions wire check - #10
Merged
Merged
Conversation
kafka's healthcheck ran kafka-broker-api-versions, which boots a fresh JVM on every probe and exceeds its 10 s timeout on CPU-loaded CI runners even after Kafka logs '[KafkaServer id=1] started' (keploy/api-server pipeline 10651, step 41). Replace the healthcheck command in docker-compose.yml with a direct Kafka wire-protocol ApiVersions v0 request using the image's stdlib python3 (zero JVM startup), verifying correlation_id, error_code == 0, non-zero API version count, and exact frame length within the existing interval/timeout/retries bounds (15s/10s/10). Add scripts/test_kafka_healthcheck.py to pin the non-JVM probe and bounds and test the exact YAML command against valid and invalid local TCP responders. Signed-off-by: slayerjain <shubhamkjain@outlook.com>
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.
Why
In
keploy/api-serverWoodpecker pipeline 10651 (step 41,atg-with-mocks > regression), Phase 5 recreatedorderflow-kafka(confluentinc/cp-kafka:7.4.0) on a fresh empty anonymous volume (Loaded 0 logs in 69ms), and the broker logged[KafkaServer id=1] startedat14:48:12— 7 seconds after start — yetdocker compose up -d --waitfailed about 3 minutes later withcontainer orderflow-kafka is unhealthy(Up 4 minutes (unhealthy)).docker-compose.ymlprobes Kafka withkafka-broker-api-versions --bootstrap-server localhost:9092(interval: 15s,timeout: 10s,retries: 10). Each healthcheck boots a fresh JVM to send oneApiVersionsrequest. Under runner CPU contention, JVM startup alone exceeds the 10 s timeout, causing consecutiveHealth check exceeded timeout (10s)failures until Docker marks the running broker unhealthy. Fixing this inorderflow/docker-compose.ymlcovers all 8 Kafka bring-ups inatg-with-mocks, including the 5keploysandbox record/test steps that composeorderflow/docker-compose.ymlalone.Merge order: 1. merge this
keploy/orderflowPR intoorder_messagefirst; 2. merge the companionkeploy/api-serverPR (fix/regression-kafka-phase5-restart-next) intomainsecond.What
docker-compose.yml: replaceservices.kafka.healthcheck.testwith a zero-JVM Kafka wire-protocolApiVersionsv0 (API key 18, version 0) probe over TCP using the container image's stdlibpython3, verifying the returnedcorrelation_id,error_code == 0, non-zero API version count, and exact frame length (10 + 6 * cnt) while keeping the existinginterval: 15s,timeout: 10s, andretries: 10bounds unchanged.scripts/test_kafka_healthcheck.py: standalone Pythonunittestsuite pinning the non-JVM probe and existing15s/10s/10bounds, and executing the exacthealthcheck.testcommand parsed fromdocker-compose.ymlagainst local TCP responders covering a validApiVersionsv0 reply, a closed port, an HTTP non-Kafka server, a non-zero Kafkaerror_code, a mismatchedcorrelation_id, an empty API versions list, and a truncated response frame.Evidence
docker-compose.ymlalone, no regression override) before vs after under identical CPU throttling (cpus: 0.09, existing15s/10s/10bounds, HEAD02d01a2e0a1f6cda55d5541cf3ded0f71d30ed47vsorigin/order_messagecb5403b27):origin/order_message(JVMkafka-broker-api-versions): Kafka started (Loaded 0 logs in 298ms,[KafkaServer id=1] startedat01:34:32Z), thendocker compose up -d --waitexited 1 at265 s(Status: unhealthy,FailingStreak: 10, repeatedExitCode: -1"Health check exceeded timeout (10s)"). Direct JVM probe timings on the running throttled broker:15,853 ms,21,619 ms,20,099 ms.02d01a2e0(PythonApiVersionsv0):75 s(Status: healthy,FailingStreak: 0; Docker's passing healthcheck probe took403 ms, rejectingConnectionRefusedErrorwhile Kafka was booting).4 ms,98 ms,98 msin-container (452 ms,403 ms,497 msincludingdocker exec).docker rm -f+docker compose up -d --waitatcpus: 0.09): exited 0 in75 s(Status: healthy,FailingStreak: 0; Docker's passing healthcheck probe took497 ms).02d01a2e0a1f6cda55d5541cf3ded0f71d30ed47:docker compose -f docker-compose.yml config: valid.python3 -m unittest -v scripts/test_kafka_healthcheck.py: 8/8 tests passed in bothKEPLOY_PROVENunset andKEPLOY_PROVEN=1.KEPLOY_PROVENunset andKEPLOY_PROVEN=1: revert tokafka-broker-api-versions, weaken totrue, ignore non-zero Kafkaerror_code, and weaken to a bare TCPcreate_connection().close()check.