Kafka binder skips failed input records when DLQ publication fails
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 55/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- java, kafka, spring, spring-boot
- Bereich
- backend-api-design, distributed-systems
Rechercherichtung
Start with DlqSender.sendToDlq() in binders/kafka-binder/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java and trace its send failure handling and manual acknowledgment. Reproduce the reported case with the embedded Kafka integration test setup; done means a failed DLQ send leaves the input offset eligible for redelivery while successful DLQ publication retains the expected behavior.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the issue
With enableDlq=true, the Kafka binder swallows DLQ publication failures and allows the input offset to be committed, even though neither processing nor DLQ publication succeeded.
The issue also occurs with dlqProducerProperties.sync: true; synchronous publication does not prevent it.
To Reproduce
- Configure a non-batch Kafka consumer with:
- An explicit consumer group.
enableDlq: trueand a configureddlqName.dlqProducerProperties.sync: true.ackMode: RECORD.
- Make processing throw an exception.
- Force DLQ publication to fail—for example, configure a DLQ value serializer that throws
SerializationException. - Publish a record and wait for processing retries to be exhausted.
- Observe
Error sending to DLQbeing logged, but the consumer group's committed offset advancing past the failed record. - Publish another record to the same partition and observe that consumption continues.
Versions of the framework
- Spring Boot: 4.2.0
- Spring Cloud: 2026.0.0
- Spring Cloud Stream Kafka binder: 5.1.0
- Spring Kafka: 4.2.0
Expected behavior
A failed DLQ publication should not count as successful recovery. The input record should remain eligible for redelivery rather than having its offset committed.
Verification performed
An embedded-Kafka integration test confirmed through Kafka's Admin API that:
- The failed record's offset was committed before any subsequent record was published.
- The DLQ remained empty.
- Subsequent records were consumed.
An external-cluster test also demonstrated the DLQ failure followed by continued consumption and a commit attempt past the failed record.
Additional context
In DlqSender.sendToDlq(), the binder waits for the send result, but catches publication exceptions and only logs them without rethrowing.
Additionally, manual acknowledgment occurs in finally, regardless of publication success.
This report concerns the non-transactional Kafka binder with enableDlq, not the Kafka Streams binder.
- Vorherrschende Sprache
- Java
- Sterne
- 1.1k
- Forks
- 657
- Ø Merge
- 1 T. 18 Std.
- Gemergte PRs (30 T.)
- 8
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus spring-cloud/spring-cloud-stream
-
Move the spring-cloud-commons version and BOM import from the bus parent to the stream parentEvtl. vergeben @olegz hat das heute übernommen. Offentask
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
spring-cloud/spring-cloud-stream#3355 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Clarify support for manual ack/nack with batch mode + DLQ; potential bug in acknowledge(index) pathOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
spring-cloud/spring-cloud-stream#3189 · 3 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Add RecordInterceptor support for Kafka Streams binderEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offenenhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
spring-cloud/spring-cloud-stream#3188 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
task
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 48/100
spring-cloud/spring-cloud-stream#3187 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
spring-cloud/spring-cloud-stream#3177 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in spring-cloud/spring-cloud-stream
Ähnliche Issues
-
enhancement infra
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
Maintainer antworten meist innerhalb von 1 Tag
-
5.0.x backport bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
spring-cloud/spring-cloud-function#1569 ·
Maintainer antworten meist innerhalb von 1 Tag
-
NoSuchMethodError in the circuit breaker since 3.103.0 when resilience4j 2.x is on the classpathOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
oracle/oci-java-sdk#803 ·
-
area:cpan-port area:performance bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
fglock/PerlOnJava#2230 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100