Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #713 from Parsely/bugfix/decode_failure_exception
Browse files Browse the repository at this point in the history
fix exception when messageset is too large for decode buffer
  • Loading branch information
emmettbutler authored Aug 24, 2017
2 parents 878b1ff + 92b75f3 commit 467c047
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pykafka/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ class NoMessagesConsumedError(KafkaException):
pass


class MessageSetDecodeFailure(KafkaException):
"""Indicates a generic failure in the decoding of a MessageSet from the broker"""
pass


class ProducerQueueFullError(KafkaException):
"""Indicates that one or more of the AsyncProducer's internal queues contain at least max_queued_messages messages"""
pass
Expand Down
4 changes: 2 additions & 2 deletions pykafka/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@


from .common import CompressionType, Message
from .exceptions import ERROR_CODES, MessageSizeTooLarge
from .exceptions import ERROR_CODES, MessageSetDecodeFailure
from .utils import Serializable, compression, struct_helpers
from .utils.compat import iteritems, itervalues, buffer

Expand Down Expand Up @@ -379,7 +379,7 @@ def decode(cls, buff, partition_id=-1):
messages.append(message)
offset += size
if len(messages) == 0 and attempted:
raise MessageSizeTooLarge(size)
raise MessageSetDecodeFailure(size)
return MessageSet(messages=messages)

def pack_into(self, buff, offset):
Expand Down

0 comments on commit 467c047

Please sign in to comment.