Kafka binder skips failed input records when DLQ publication fails

Đang mở
#3,350 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@itsgourav62 đang làm issue này rồi.

Từ ngày 28/11/2026.

  • #3352 của @itsgourav62 — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java, kafka, spring, spring-boot

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
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
  1. Configure a non-batch Kafka consumer with:
    • An explicit consumer group.
    • enableDlq: true and a configured dlqName.
    • dlqProducerProperties.sync: true.
    • ackMode: RECORD.
  2. Make processing throw an exception.
  3. Force DLQ publication to fail—for example, configure a DLQ value serializer that throws SerializationException.
  4. Publish a record and wait for processing retries to be exhausted.
  5. Observe Error sending to DLQ being logged, but the consumer group's committed offset advancing past the failed record.
  6. 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.

Ngôn ngữ chính
Java
Star
1.1k
Fork
657
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
8

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của spring-cloud/spring-cloud-stream

Tất cả issue của spring-cloud/spring-cloud-stream

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.