Skip to content

fix(binding-kafka): recover produce and fetch when a broker connection is lost - #2616

Merged
jfallows merged 5 commits into
aklivity:support/1.xfrom
ankitk-me:fix/kafka-disconnect-meta-refresh
Sep 29, 2026
Merged

jfallows merged 5 commits into
aklivity:support/1.xfrom
ankitk-me:fix/kafka-disconnect-meta-refresh

Conversation

@ankitk-me

Copy link
Copy Markdown
Contributor

No description provided.

ankitk-me and others added 4 commits September 28, 2026 12:45
When a produce or fetch connection to a broker ends, aborts or resets,
the client streams cleaned up without refreshing metadata. Cached
partition leaders kept pointing at the departed broker until the next
scheduled metadata refresh, so reconnects targeted the same broker.

Trigger an immediate metadata refresh from the network end, abort and
reset handlers of the client produce and fetch streams, reusing the
existing metaFlush hook used for retriable error codes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When a produce connection to a broker aborted or reset, the client
produce stream reset the application stream without an error code.
The cache treated this as a non-retriable unknown error and failed the
pending records, instead of reconnecting and resending them as it does
for other retriable errors.

Report NETWORK_EXCEPTION on network abort or reset in the client
produce stream, and handle it in the cache server produce fanout the
same way as NOT_LEADER_FOR_PARTITION, so the cache client reconnects
and resends the pending records.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ode buffer

The produce client credits the application window per record as value
size plus a fixed framing padding, but a record's key and headers are
encoded into the same buffer slot. When key and headers exceed the
padding and records accumulate while a produce request is in flight,
the encoded records overrun the encode slot.

- raise the advertised window padding once a record's framing (batch,
  record header, key and headers) exceeds the configured framing size
- size the pre-encode capacity check from the current record instead
  of the previous record's value size
- reset the stream rather than write past the encode slot when a
  record cannot fit

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ivery

The cache server acknowledged every entry up to the latest offset
signaled by the cache client whenever the produce client stream was
fully acknowledged, including entries not yet sent or still in flight.
If the in-flight produce request then failed with a retriable error,
those entries were already marked complete, so they were skipped on
reconnect and never produced, while the producer had already been
told they succeeded.

Acknowledge success only up to the last entry delivered by the cursor,
and defer the acknowledgement when skipping a completed entry until
all in-flight data has been acknowledged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ankitk-me
ankitk-me marked this pull request as ready for review September 29, 2026 02:30
@ankitk-me ankitk-me self-assigned this Sep 29, 2026
@ankitk-me
ankitk-me requested a review from jfallows September 29, 2026 04:39
@jfallows
jfallows merged commit 9387845 into aklivity:support/1.x Sep 29, 2026
105 of 108 checks passed
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