Skip to content

Raise timeout for unfinished producer futures at deadline - #3169

Open
AryanRG wants to merge 1 commit into
dpkp:masterfrom
AryanRG:fix/pending-producer-future-timeout
Open

AryanRG wants to merge 1 commit into
dpkp:masterfrom
AryanRG:fix/pending-producer-future-timeout

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 17, 2026

Copy link
Copy Markdown

KafkaProducer.send(...).get(timeout=0) can currently return None while the record is still pending. A positive timeout can do the same if a batch-split wakeup reaches the deadline before the next loop iteration. An unfinished future should raise KafkaTimeoutError, not appear to have returned a delivery result.

Move the deadline check inside the wait loop so completed success/error results still win, while unfinished calls raise when the budget expires. Add MockBroker regressions for pending sends, eventual success/failure after a timeout, and a controlled rebind at the deadline.

Local validation on macOS / Python 3.13.12:

  • Three new cases fail on unchanged master; all five focused cases pass with the fix.
  • Producer and future suites: 312 passed with the selector backend, and 312 passed with the asyncio backend.
  • Changed production file passes pylint errors-only and git diff --check.

No real broker, full repository suite, other Python versions, or hosted CI was run locally. AI assistance was used to investigate, implement, review, and test this change.

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.

1 participant