zeromq / netmq

A 100% native C# implementation of ZeroMQ for .NET
Other
2.97k stars 746 forks source link

System.IndexOutOfRangeException using Push sockets #20

Closed tobi-tobsen closed 12 years ago

tobi-tobsen commented 12 years ago

Context:

I tried porting the libzmq performance tests since the netmq readme (https://github.com/zeromq/netmq#netmq) suggested these are missing and I were curious and wanted to help you guys).

I created the throughput test along the lines to the original libzmq version. If you want I can create a pull request from that commit: https://github.com/tobi-tobsen/netmq/tree/perf_throughput

Bug:

When running the tests I getting the following exception on the push-side (remote_thr):

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.   at NetMQ.zmq.ByteArraySegment.set_Item(Int32 i, Byte value) in C:\Users\tobsen\Documents\GitHub\netmq\src\NetMQ\zmq\ByteArraySegment.cs:line 110   at NetMQ.zmq.V1Encoder.MessageReady() in C:\Users\tobsen\Documents\GitHub\netmq\src\NetMQ\zmq\V1Encoder.cs:line 83   at NetMQ.zmq.V1Encoder.Next() in C:\Users\tobsen\Documents\GitHub\netmq\src\NetMQ\zmq\V1Encoder.cs:line 36   at NetMQ.zmq.EncoderBase.GetData(ByteArraySegment& data, Int32& size) in C:\Users\tobsen\Documents\GitHub\netmq\src\NetMQ\zmq\EncoderBase.cs:line 87   at NetMQ.zmq.StreamEngine.OutEvent() in C:\Users\tobsen\Documents\GitHub\netmq\src\NetMQ\zmq\StreamEngine.cs:line 267   at NetMQ.zmq.IOObject.OutEvent() in C:\Users\tobsen\Documents\GitHub\netmq\src\NetMQ\zmq\IOObject.cs:line 96   at NetMQ.zmq.Poller.Loop() in C:\Users\tobsen\Documents\GitHub\netmq\src\NetMQ\zmq\Poller.cs:line 195   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)   at System.Threading.ThreadHelper.ThreadStart()

Steps to reproduce:

somdoron commented 12 years ago

i think i fixed this with the last pull request.

Regarding the performance test, very nice, please add pull request and i will merge it.

somdoron commented 12 years ago

tobi please confirm that it's fixed

tobi-tobsen commented 12 years ago

This seems to be fixed. I created a pullrequest for the performance test https://github.com/zeromq/netmq/pull/24 . However that doesn't currently work due to another issue which results in the received message being empty (empty as in zero size). I will create a new bug report for that.