Skip to content

out_rdkafka2: Apply unrecoverable_error_codes to delivery report errors - #579

Merged
kenhys merged 2 commits into
fluent:masterfrom
Watson1978:rdkafka2-unrecoverable-delivery-errors
Sep 2, 2026
Merged

out_rdkafka2: Apply unrecoverable_error_codes to delivery report errors#579
kenhys merged 2 commits into
fluent:masterfrom
Watson1978:rdkafka2-unrecoverable-delivery-errors

Conversation

@Watson1978

@Watson1978 Watson1978 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

unrecoverable_error_codes was only checked inside enqueue_with_retry, so it applied when producer.produce raised but not when the same code came back through the delivery report. With the default settings an oversized message rejected by the broker was re-raised as a plain Rdkafka::RdkafkaError and the chunk was retried until retry_timeout expired.

Note for existing users: on the delivery report path the default codes now divert the chunk to the secondary output or to the backup directory instead of retrying it. This is what the parameter already did on the produce path since #510. Setting unrecoverable_error_codes to an empty value retries every error.

- The list was only checked when producer.produce raised synchronously,
  so the same code reported through handler.wait was re-raised as is and
  the chunk kept being retried even for the default msg_size_too_large
- Check the code once in write's rescue so both paths raise
  Fluent::UnrecoverableError, with discard_kafka_delivery_failed still
  taking precedence
- Let unknown_topic and unknown_partition reach the check so listing
  them in unrecoverable_error_codes takes effect
- Match Rdkafka::RdkafkaError instead of any exception answering #code,
  since the rescue now spans the whole write body
- Document the parameter in README, including how a code is spelled

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978
Watson1978 requested a review from kenhys September 2, 2026 02:40
Comment thread README.md Outdated
Co-authored-by: Kentaro Hayashi <kenhys@gmail.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
@Watson1978
Watson1978 force-pushed the rdkafka2-unrecoverable-delivery-errors branch from c6d32a0 to 72725d6 Compare September 2, 2026 07:03
@Watson1978
Watson1978 requested a review from kenhys September 2, 2026 07:03
@kenhys
kenhys merged commit 9aec5d9 into fluent:master Sep 2, 2026
32 checks passed
@Watson1978
Watson1978 deleted the rdkafka2-unrecoverable-delivery-errors branch September 2, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants