Skip to content

Buffer errors #422

@troepolik

Description

@troepolik

Describe the bug

We faced with very rare errors in consuming :

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'length')
   at System.ThrowHelper.ThrowStartOrEndArgumentValidationException(Int64 start)
   at System.Buffers.ReadOnlySequence`1.Slice(Int64 start, Int64 length)
   at RabbitMQ.Stream.Client.RawConsumer.<>c__DisplayClass19_0.<ParseChunk>g__MessageFromSequence|0(ReadOnlySequence`1& unCompressedData, Int32& compressOffset) in /_/RabbitMQ.Stream.Client/RawConsumer.cs:line 269

Error | | Error while parsing message Consumer id 0 for stream: xxx, identifier: , reference: xxx, OffsetSpec RabbitMQ.Stream.Client.OffsetTypeOffset Client ProvidedName xxx, No SuperStream, IsSingleActiveConsumer: False, Token IsCancellationRequested: False . The message will be skipped. Please report this issue to the RabbitMQ team on GitHub https://github.com/rabbitmq/rabbitmq-stream-dotnet-client/issues

Issue looks like corrupted internal buffer or mb buffer that used by few threads in the same time.
I dont know if it related or not - we have few parallel consumers, each consumes own queue.

Some times we also have some different type of error, but it also look like corrupted or used by few threads buffer:

System.Text.Json.JsonException: 'r' is an invalid end of a number. Expected a delimiter. Path: $ | LineNumber: 0 | BytePositionInLine: 7850.

We control message body, so I can guarantee that we publish proper json.
We deserialize messages like that:

Utf8JsonReader reader = new(message.Data.Contents);
var msg = JsonSerializer.Deserialize<TMessage>(ref reader);

client version : 1.8.14 - latest
server: RabbitMQ 3.12.0, Erlang 26.2.5

Reproduction steps

  1. Error happens very rare - once per 2 days , so I can not reproduce it locally

Expected behavior

I expect consuming without errors

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions