Kafka binder skips failed input records when DLQ publication fails
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- java, kafka, spring, spring-boot
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Java
- 星标
- 1.1k
- 派生
- 657
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 8
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
spring-cloud/spring-cloud-stream 的其他 Issue
-
Move the spring-cloud-commons version and BOM import from the bus parent to the stream parent可能已有人在做 @olegz 今天认领。 未关闭task
难度 2/5 1-3 小时 新手友好度 74/100
spring-cloud/spring-cloud-stream#3355 ·
维护者通常 1 天内回复
-
Clarify support for manual ack/nack with batch mode + DLQ; potential bug in acknowledge(index) path未关闭
难度 4/5 3-5 天 新手友好度 48/100
spring-cloud/spring-cloud-stream#3189 · 3 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
Add RecordInterceptor support for Kafka Streams binder可能重新可做 关联的 PR 已关闭且未合并。 未关闭enhancement
难度 5/5 一周以上 新手友好度 35/100
spring-cloud/spring-cloud-stream#3188 · 4 条评论 ·
维护者通常 1 天内回复
-
task
难度 3/5 1-2 天 新手友好度 48/100
spring-cloud/spring-cloud-stream#3187 · 2 条评论 ·
维护者通常 1 天内回复
-
bug
难度 5/5 一周以上 新手友好度 25/100
spring-cloud/spring-cloud-stream#3177 · 1 条评论 ·
维护者通常 1 天内回复
查看 spring-cloud/spring-cloud-stream 的全部 Issue
相似的 Issue
-
area:cpan-port area:performance bug
难度 2/5 1-3 小时 新手友好度 72/100
fglock/PerlOnJava#2230 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 82/100
federicoiosue/Omni-Notes#1044 ·
-
Bug
难度 1/5 1 小时以内 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复