Skip to content
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

Akka.Delivery: out of bounds error when copying memory chunks #6754

Closed
Aaronontheweb opened this issue May 10, 2023 · 0 comments · Fixed by #6755
Closed

Akka.Delivery: out of bounds error when copying memory chunks #6754

Aaronontheweb opened this issue May 10, 2023 · 0 comments · Fixed by #6755
Assignees
Milestone

Comments

@Aaronontheweb
Copy link
Member

Version Information
Version of Akka.NET? 1.5.7-beta1
Which Akka.NET Modules? Akka.Delivery

Describe the bug

[ERROR][05/10/2023 15:47:50.982Z][Thread 0070][akka://SqlSharding/user/product-proxy/product-proxy/producer-controller-58ae030a-cb93-4ce4-85e9-f85010ef4fcd] Provided length [1024] of array to copy doesn't fit array length [4505] wit
hin given offset [4096] (Parameter 'count')
Cause: System.ArgumentException: Provided length [1024] of array to copy doesn't fit array length [4505] within given offset [4096] (Parameter 'count')
   at Akka.IO.ByteString.CopyFrom(Byte[] array, Int32 offset, Int32 count)
   at Akka.Delivery.Internal.ProducerController`1.CreateChunks(T msg, Int32 chunkSize, Serialization serialization)+MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Akka.Delivery.Internal.ProducerController`1.Chunk(T msg, Boolean ack, Serialization serialization)
   at Akka.Delivery.Internal.ProducerController`1.<Active>b__30_1(T sendNext)
   at lambda_method51(Closure , Object , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Action`1 , Func`2 , Action`1 )
   at Akka.Tools.MatchHandler.PartialHandlerArgumentsCapture`15.Handle(T value)
   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.ProducerController`1.AroundReceive(Receive receive, Object message)
   at Akka.Actor.ActorCell.ReceiveMessage(Object message)
   at Akka.Actor.ActorCell.Invoke(Envelope envelope)

Looks like a simple bounds-checking error when we're copying small chunks into arrays that are larger (due to the shared memory pool.)

@Aaronontheweb Aaronontheweb added this to the 1.5.7 milestone May 10, 2023
@Aaronontheweb Aaronontheweb self-assigned this May 10, 2023
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue May 10, 2023
Error was caused by requesting a chunkSize greater than the remaining bytes. Also - changed methods so we no longer copy memory during chunking.
Aaronontheweb added a commit that referenced this issue May 10, 2023
… messages (#6755)

* close #6754 - fix chunking bounds check

Error was caused by requesting a chunkSize greater than the remaining bytes. Also - changed methods so we no longer copy memory during chunking.

* avoid more copying

* Update ProducerControllerSpec.cs
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