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

fix exception when messageset is too large for decode buffer #713

Merged
merged 1 commit into from
Aug 24, 2017
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
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