Skip to content

Commit

Permalink
Do not choke on MessageSet without version
Browse files Browse the repository at this point in the history
If we end un unlucky and MessageSet buffer is truncated right before
we can read magic value, we just return `ErrInsufficientData`, even
if some messages were previously successfully parsed.

This propagates all the way up to `partitionConsumer`, where we zero
parsed messages, which results in `ErrMessageTooLarge` returned
to the consumer.

This commit fixes the issue by setting `PartialTrailingMessage` to `true`
on `MessageSet`, making it possible to read successfully parsed messages.
  • Loading branch information
bobrik committed Feb 1, 2018
1 parent 0f4f8ca commit 885c1b0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions message_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ func (ms *MessageSet) decode(pd packetDecoder) (err error) {
for pd.remaining() > 0 {
magic, err := magicValue(pd)
if err != nil {
if err == ErrInsufficientData {
ms.PartialTrailingMessage = true
return nil
}
return err
}

Expand Down

0 comments on commit 885c1b0

Please sign in to comment.