Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kafka/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ class UnsupportedCodecError(KafkaError):
pass


class TransactionAbortedError(KafkaError):
pass


class BrokerResponseError(KafkaError):
errno = None
message = None
Expand Down
6 changes: 5 additions & 1 deletion kafka/producer/sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ def run_once(self):
self._client.poll(timeout_ms=self.config['retry_backoff_ms'])
return
elif self._transaction_manager.has_abortable_error():
self._accumulator.abort_undrained_batches(self._transaction_manager.last_error)
# Attempt to get the last error that caused this abort.
# If there was no error, but we are still aborting,
# then this is most likely a case where there was no fatal error.
exception = self._transaction_manager.last_error or Errors.TransactionAbortedError()
self._accumulator.abort_undrained_batches(exception)

except Errors.SaslAuthenticationFailedError as e:
# This is already logged as error, but propagated here to perform any clean ups.
Expand Down
Loading