Skip to content

fix(binding-kafka): release waiting streams on the first refresh or when the last meta stream is gone - #3276

Merged
jfallows merged 3 commits into
test/3254-kafka-api-meta-refresh-coveragefrom
fix/3255-kafka-meta-refresh-failure-scope
Nov 17, 2026
Merged

jfallows merged 3 commits into
test/3254-kafka-api-meta-refresh-coveragefrom
fix/3255-kafka-meta-refresh-failure-scope

Conversation

@jfallows

Copy link
Copy Markdown
Contributor

Description

A raw API request stream addressed to a broker id that the route's table does not know waits for a Metadata refresh and is then answered with the existing reset. Until now the route released the waiting streams on the first completion or failure of any meta stream on the route. That has two consequences:

  • A route has one meta stream per topic, so it can have several at once. A failure of a meta stream that was not carrying the refresh a stream was waiting for reset the waiting stream before its own refresh had finished.
  • When the last meta stream on the route was closed by its own application with END or ABORT while a stream was waiting, nothing released the waiting stream.

The route now decides the release in one place. KafkaClientRoute.unregisterMetaFlush removes the meta stream and releases the waiting streams only when no meta stream remains registered on the route (hasMeta()). A successful refresh releases them as before, and cleanupApplication no longer releases them itself. A failure of one of several meta streams therefore no longer releases them.

No existing pattern in the module does this; placing the release decision in the route's unregister is a design choice made for this issue.

What stays unchanged

  • An in-flight successful refresh that was requested before the stream began waiting can still release it.
  • There is no retry: a released stream is still answered with the existing reset, even when the refreshed table now contains the broker id.

Tests

The first commit (5d786a3) adds two scenarios to the existing KafkaCreateTopicsIT classes, with paired application and network scripts: create.topics.v7.broker.unknown.refresh.meta.aborted and create.topics.v7.broker.unknown.refresh.meta.ended. The last meta stream on the route is closed by its own application with ABORT or END while an API stream to an unknown broker id is waiting, and the API stream must then be reset. On the unmodified binding they fail only because that reset never arrives; with the change they pass.

clean verify of specs/binding-kafka.spec and runtime/binding-kafka with the module checks on and the build cache skipped: both modules build successfully, with no failures or errors in the unit tests (226 and 229) or the spec and runtime ITs (490 and 465 run, 12 and 67 skipped).

Exception to the test-first rule

The case where one of several meta streams fails while another carries the refresh has no failing test, by the maintainer's explicit decision. No k3po script can fail before the change: k3po buffers an event that arrives early at a read await barrier, and it cannot assert the order of two frames on different streams (the waiting stream's reset and the refreshed data on the other meta stream), which is the only difference between the old and the new behaviour. That case is therefore not covered by a failing test.

Stacking

This branch is stacked on test/3254-kafka-api-meta-refresh-coverage and is based on it.

Fixes #3255


Generated by Claude Code

…last meta stream closes

A raw API request stream addressed to a broker id the route's table does not know waits for a
Metadata refresh before it is answered with the existing reset. When the only meta stream on the
route is closed by its own application, either with END or with ABORT, while that refresh is in
flight, the waiting stream must still be answered; it is not, so the scripts below fail until the
route releases waiters once its last meta stream has unregistered.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SiHVoVCAexPDhCJ4HBPixy
…when the last meta stream is gone

A stream waiting for a broker table refresh was released by the first completion or failure of any
meta stream on the route, so a failure of a meta stream that was not carrying the refresh reset the
waiting stream before its own refresh had finished, and a waiting stream was never released when the
last meta stream was closed by its own application with END or ABORT.

The route now decides the release in one place. A meta stream that unregisters releases the waiting
streams only when no meta stream remains registered on the route, and a successful refresh releases
them as before. A failure of one of several meta streams no longer releases them.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SiHVoVCAexPDhCJ4HBPixy
@jfallows
jfallows added this pull request to stack #3297 November 16, 2026 23:24
@jfallows
jfallows merged commit 7662eee into develop Nov 17, 2026
30 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.

binding-kafka: a failure of any meta stream on a route releases the streams waiting for a broker table refresh (design)

2 participants