Kafka binder health-check consumer failures return DOWN without logging the exception
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
- #3331 par @Sanskar121543 — fermée sans fusion
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 25/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- À l'abandon
- Stack technique
- java, kafka, spring-boot
- Domaine
- backend, observability
Piste de recherche
Start with AbstractKafkaBinderHealthIndicator.buildTopicsHealth() and safelyBuildTopicsHealth() in the Kafka binder core; the issue identifies both as paths that convert failures into health results without logging. Read the existing logging conventions for health indicator failures, then check that the returned health status remains DOWN and the underlying exception is logged without repeated probe failures flooding logs.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the issue
The Kafka binder can report DOWN because its health-check metadata consumer cannot be constructed, without logging the failure or its underlying cause. Meanwhile, application startup and the actual listener containers can succeed.
The health endpoint exposes only:
org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
In the case we investigated, the underlying exception was:
java.lang.IllegalStateException: No delegate deserializer configured
This report is about missing error logging, not about accepting an incomplete deserializer configuration. Returning DOWN is appropriate, but the diagnostic cause should also be available in the application logs.
To Reproduce
The following is a reduced configuration illustrating the triggering setup: use ErrorHandlingDeserializer at binder scope and configure its value delegate only at binding scope.
-
Start a Spring Boot application with Actuator, the web starter, the Spring Cloud Stream Kafka binder, and a reachable plaintext Kafka broker.
-
Register a simple function:
@Bean public Consumer<String> consume() { return value -> {}; } -
Configure the binder and binding:
management: endpoint: health: show-details: always spring: cloud: function: definition: consume stream: bindings: consume-in-0: destination: health-repro group: health-repro consumer: useNativeDecoding: true kafka: binder: brokers: localhost:9092 consumer-properties: key.deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer value.deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer spring.deserializer.key.delegate.class: org.apache.kafka.common.serialization.StringDeserializer bindings: consume-in-0: consumer: configuration: spring.deserializer.value.delegate.class: org.apache.kafka.common.serialization.StringDeserializer -
Let the application start, then call
GET /actuator/health. -
Observe that binder health is
DOWNwithFailed to construct kafka consumer, despite the listener container running. No corresponding health-check exception or nested cause is logged at WARN/ERROR.
The failure was reproduced in a multi-binder application and an HTTP integration test. The reduced single-binder example above is provided to illustrate the configuration pattern; it has not been run as a separate sample project.
Version of the framework
- Spring Boot: 4.1.2
- Spring Cloud release train: 2025.1.4
- Spring Cloud Stream: 5.0.4
- Spring Cloud Stream Kafka binder and Kafka binder core: 5.0.4
- Spring for Apache Kafka (
spring-kafka): 4.1.2 - Apache Kafka clients: 4.2.2
- Java: Eclipse Temurin 25.0.5
The Spring Boot, Spring Cloud, and Java settings were checked against the application build configuration. The packaged application JAR confirms the resolved Spring Boot, Spring Cloud Stream, Spring Kafka, and Kafka client versions. The failing HTTP integration test ran on Java 25.0.5. The exception-to-health-result handling was also checked in the released v5.0.4 source and on the main branch.
Expected behavior
When metadata consumer construction fails, log an ERROR identifying the Kafka binder health check and include the exception and full cause chain. If WARN is the project's convention for health-indicator failures, that would still be substantially more actionable than the current silent conversion.
The health endpoint should continue returning DOWN; startup need not fail solely because of a lazily created health-check consumer. Logging is expected when the health check actually encounters the failure, not necessarily during startup.
Please consider logging on the initial failure/state transition or otherwise deduplicating/rate-limiting repeated failures, so regular health probes do not flood logs with identical stack traces. There is no need to log configuration maps or credentials.
Additional context
The relevant code paths appear to be:
KafkaBinderHealthIndicatorConfiguration.kafkaBinderHealthIndicator(): starts with byte-array deserializers, then merges binder consumer configuration over them. Binding-specific delegate settings are not included.AbstractKafkaBinderHealthIndicator.buildTopicsHealth(): catches the exception and returnsHealth.down(ex).build()without logging it.AbstractKafkaBinderHealthIndicator.safelyBuildTopicsHealth(): also converts execution failures into a health result without logging.
Because the exception is handled inside the indicator, the exception-logging path in the superclass is not reached. Health details retain the outer exception message rather than the useful nested deserializer error.
Supplying spring.deserializer.value.delegate.class at binder scope resolves this particular configuration failure, while bindings can still override the delegate as needed. However, that workaround does not address the missing diagnostics for this or other health-check failures.
I searched existing open issues for the exact error, missing delegates, the health indicator class, and health-check logging. Related but apparently different reports include spring-cloud/spring-cloud-stream#2958 (binary compatibility), spring-cloud/spring-cloud-stream#3042 (custom multi-binder indicators), and spring-cloud/spring-cloud-stream#3138 (Kafka Streams/DNS connectivity).
- Langage dominant
- Java
- Étoiles
- 1.1k
- Forks
- 653
- Merge moyen
- 12 h 59 min
- PR mergées (30 j)
- 7
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de spring-cloud/spring-cloud-stream
-
Deadlock between `KafkaBinderMetrics.close()` and the offset-lag task on context shutdownPeut-être pris @caiocv18 l’a pris il y a 4 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
spring-cloud/spring-cloud-stream#3332 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
DefaultPollableMessageSource: invoke afterSendCompletion for already-applied interceptors when a message is discardedPeut-être pris @ferblaca l’a pris il y a 4 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 74/100
spring-cloud/spring-cloud-stream#3316 ·
Les mainteneurs répondent en général sous 1 jour
-
StreamBridge removing BindingProperties leads to wrong destination in ProvisioningProviderPeut-être à nouveau libre @olegz l’a pris il y a 64 jours, et aucune pull request n’est ouverte. Ouvertebug
spring-cloud/spring-cloud-stream#3257 · 6 commentaires · 2 réactions · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
StreamBridge's hashProducerProperties produces hash collisions across different binding names, causing Partition key cannot be nullPeut-être à nouveau libre Une pull request pour cette issue a été fermée sans être fusionnée. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
spring-cloud/spring-cloud-stream#3242 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
v4.3.3 no longer adds a header "TIMESTAMP" on kafka messages consumedPeut-être à nouveau libre @olegz l’a pris il y a 95 jours, et aucune pull request n’est ouverte. OuverteBackport 4.3.x bug
spring-cloud/spring-cloud-stream#3211 · 3 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de spring-cloud/spring-cloud-stream
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
langchain4j/langchain4j#7068 ·
Les mainteneurs répondent en général sous 1 jour
-
Mend: dependency security vulnerability untriaged
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
opensearch-project/k-NN#3693 ·
Les mainteneurs répondent en général sous 1 jour
-
Disk full for windows GH actionOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: Encrypted PDF portfolios show an empty portfolio panelPeut-être pris @christophmertins l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Stirling-Tools/Stirling-PDF#8864 · 1 réaction ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
CodingDocs/awesome-java#41 · 1 commentaire ·