Skip to content

fix(producer): treat kafka_storage_error as retriable - #667

Merged
zmstone merged 1 commit into
kafka4beam:masterfrom
whatyouhide:260714-producer-retry-kafka-storage-error
Jul 19, 2026
Merged

fix(producer): treat kafka_storage_error as retriable#667
zmstone merged 1 commit into
kafka4beam:masterfrom
whatyouhide:260714-producer-retry-kafka-storage-error

Conversation

@whatyouhide

@whatyouhide whatyouhide commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Hey all! Andrea from the Elixir core team here.

We just started using brod (under broadway_kafka) at Knock, for communicating with WarpStream.

This PR adds ?kafka_storage_error (KAFKA_STORAGE_ERROR, error code 56) to brod_producer:is_retriable/1, so a produce response carrying it nacks the buffer and schedules a retry (same path as request_timed_out) instead of exiting the producer with {not_retriable, _}.

The idea is that the Kafka protocol classifies error 56 as Retriable=True ("Disk error when trying to access log file on the disk"; see the protocol error table). For example, the Java client automatically retries it on Produce. brod currently treats it as fatal.

The failure mode is worse than a plain error: exit({not_retriable, _}) kills the producer and loses its whole internal buffer, so a transient broker-side storage blip becomes message loss for any caller that doesn't wrap brod in its own retry layer.

We noticed this because we use WarpStream (Kafka-compatible, S3-backed), which uses KAFKA_STORAGE_ERROR as its generic "back off and retry" code. Their docs explicitly call it "a retriable error code" and several changelog entries pick error 56 precisely because compliant clients treat it as transient.

I'm opening this because in production we observed a single WarpStream-side blip take down a bunch of brod producers (across 12 pods within 15ms 😮), all with {not_retriable, {produce_response_error, Topic, Partition, -1, kafka_storage_error}}.

@whatyouhide
whatyouhide force-pushed the 260714-producer-retry-kafka-storage-error branch from 616e2f7 to 70f6e18 Compare July 14, 2026 15:27
@whatyouhide
whatyouhide marked this pull request as ready for review July 14, 2026 15:28

@mikpe mikpe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zmstone
zmstone merged commit 56b1e7f into kafka4beam:master Jul 19, 2026
10 checks passed
@zmstone

zmstone commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

thank you for the pr.

  • tagged 4.5.6
  • published to hex.pm

@whatyouhide
whatyouhide deleted the 260714-producer-retry-kafka-storage-error branch July 21, 2026 06:38
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.

3 participants