Skip to content

Akka.Delivery: ConsumerController throws ArgumentOutOfRange when decoding zero-length chunk #6748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Aaronontheweb opened this issue May 9, 2023 · 0 comments · Fixed by #6749

Comments

@Aaronontheweb
Copy link
Member

Version Information
Version of Akka.NET? v1.5.7-beta*
Which Akka.NET Modules? Akka

Describe the bug

When decoding a zero-length chunk, the ConsumerController throws an "argument out of range" exception:

System.ArgumentOutOfRangeException: Provided index is outside the bounds of the buffer to copy to. (Parameter 'index')
   at Akka.IO.ByteString.CopyTo(Memory`1& buffer, Int32 index, Int32 count)
   at Akka.Delivery.Internal.ConsumerController`1.AssembleChunks(ImmutableList`1 collectedChunks)
   at Akka.Delivery.Internal.ConsumerController`1.Deliver(SequencedMessage`1 seqMsg)
   at Akka.Delivery.Internal.ConsumerController`1.ReceiveChangedProducer(SequencedMessage`1 seqMsg)
   at Akka.Delivery.Internal.ConsumerController`1.<Active>b__25_0(SequencedMessage`1 seqMsg)
   at lambda_method17(Closure , Object , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 )
   at Akka.Tools.MatchHandler.PartialHandlerArgumentsCapture`8.Handle(T value)
   at Akka.Actor.ReceiveActor.ExecutePartialMessageHandler(Object message, PartialAction`1 partialAction)
   at Akka.Actor.ReceiveActor.<>c__DisplayClass11_0.<Become>b__0(Object m)
   at Akka.Actor.ActorCell.<>c__DisplayClass113_0.<Akka.Actor.IUntypedActorContext.Become>b__0(Object m)
   at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
   at Akka.Delivery.Internal.ConsumerController`1.AroundReceive(Receive receive, Object message)
   at Akka.Actor.ActorCell.ReceiveMessage(Object message)
   at Akka.Actor.ActorCell.Invoke(Envelope envelope)

To Reproduce

Transmit a zero-length chunk over the wire when akka.reliable-deliery.producer-controller.chunk-large-messages = {any byte size}

Expected behavior

Should retain the zero-length chunk, as some serializers might support it (i.e. const values found in Protobuf serializers).

Actual behavior

Threw exception.

@Aaronontheweb Aaronontheweb added this to the 1.5.7 milestone May 9, 2023
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue May 9, 2023
Aaronontheweb added a commit that referenced this issue May 10, 2023
* added reproduction for #6748

* fixed zero-copy issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant