Skip to content

fix(binding-kafka): guard budget credit against released creditor slot - #2204

Open
ankitk-me wants to merge 3 commits into
aklivity:developfrom
ankitk-me:fix/2179-kafka-cache-client-produce-fan-credit-crash
Open

fix(binding-kafka): guard budget credit against released creditor slot#2204
ankitk-me wants to merge 3 commits into
aklivity:developfrom
ankitk-me:fix/2179-kafka-cache-client-produce-fan-credit-crash

Conversation

@ankitk-me

Copy link
Copy Markdown
Contributor

fixes #2179

ankitk-me and others added 3 commits July 22, 2026 21:08
…t in cache client produce fan

KafkaCacheClientProduceFan.onClientInitialData/onClientInitialFlush called
creditor.credit(traceId, partitionIndex, reserved) unconditionally, even
after onClientFanInitialClosed() had already released the budget slot and
reset partitionIndex to NO_CREDITOR_INDEX (-1L). A member stream whose
produce reply was closed via onClientFanReplyEnd/onClientFanReplyAbort keeps
its own initial open (only the reply side is forwarded to members), so a
still-producing app client can deliver another DATA/FLUSH frame that reaches
the fan and credits a released slot. DefaultBudgetCreditor.credit computes a
garbage negative buffer offset from the sentinel index and throws an
IndexOutOfBoundsException that terminates the whole EngineWorker agent
thread, dropping every unrelated connection on that worker.

Guard both credit() call sites on partitionIndex != NO_CREDITOR_INDEX, and
mirror the aklivity#1303 stream-level guard (!KafkaState.initialClosed(state)) onto
the FLUSH path, which had been left with a bare else since that fix only
covered DATA.

Fixes aklivity#2179

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant