Skip to content

KAFKA-20864: Fix to avoid early batch close if extension fails - #23008

Open
lianetm wants to merge 2 commits into
apache:trunkfrom
lianetm:lm-fix-early-close-race
Open

KAFKA-20864: Fix to avoid early batch close if extension fails#23008
lianetm wants to merge 2 commits into
apache:trunkfrom
lianetm:lm-fix-early-close-race

Conversation

@lianetm

@lianetm lianetm commented Jul 31, 2026

Copy link
Copy Markdown
Member

This PR includes the following fixes to avoid closing the wrong batch
when a mid-batch extension acquire fails on an exhausted pool:

  • close the batch only if it's the same we were trying to extend. If
    it's not, do not close it and continue the loop, so the next iteration
    checks against whatever is open (will take the new-batch path if
    nothing is open, or retry with the new open batch, sizing the extension
    needed again)
  • bound the retries the above introduces (retry of non-blocking op). Fix
    by always allowing a first attempt (it's non-blocking), but bound
    retries against the remaining max.block.ms. Edge case to ensure send
    does not exceed max.block.ms if the extension keeps failing with the
    batch being replaced.
  • track an absolute deadline, so that the non-blocking retries time also
    count against max.block.ms (like the blocking ops do)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant