MLAPI.Relay icon indicating copy to clipboard operation
MLAPI.Relay copied to clipboard

Sending fragmented data causes IndexOutOfRangeException

Open dylanpdx opened this issue 4 years ago • 0 comments

Hello,

I am having an odd issue where sending fragmented messages over the relay causes a IndexOutOfRangeException. Sending over fragmented channels works fine, but as soon as the message is too large and needs to be fragmented, issues occur. This issue doesn't happen without the relay.

Sending a fragmented message from the Server to the Client causes this to be repeatedly output into the Relay server itself

[ERROR] Exception during loop: System.ArgumentException: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
   at System.ThrowHelper.ThrowArraySegmentCtorValidationFailedExceptions(Array array, Int32 offset, Int32 count)
   at MLAPI.Relay.Transports.UnetTransport.Poll(UInt64& connectionId, Byte& channelId, ArraySegment`1& payload) in C:\Users\dylanpdx\Source\Repos\MLAPI.Relay\MLAPI.Relay\Transports\UnetTransport.cs:line 44
   at MLAPI.Relay.Program.RunLoop() in C:\Users\dylanpdx\Source\Repos\MLAPI.Relay\MLAPI.Relay\Program.cs:line 241
   at MLAPI.Relay.Program.Main(String[] args) in C:\Users\dylanpdx\Source\Repos\MLAPI.Relay\MLAPI.Relay\Program.cs:line 221

Sending a fragmented message from a Client to the Server causes this to be repeatedly thrown into the Host PC (not the relay server)

IndexOutOfRangeException: Index was outside the bounds of the array.
MLAPI.Transports.UNET.RelayTransport.BaseReceive (UnityEngine.Networking.NetworkEventType event, System.Int32 hostId, System.Int32& connectionId, System.Int32& channelId, System.Byte[] buffer, System.Int32 bufferSize, System.Int32& receivedSize, System.Byte& error) (at <10b4ebfb14e04d6583eb858de486f4fc>:0)
MLAPI.Transports.UNET.RelayTransport.Receive (System.Int32& hostId, System.Int32& connectionId, System.Int32& channelId, System.Byte[] buffer, System.Int32 bufferSize, System.Int32& receivedSize, System.Byte& error) (at <10b4ebfb14e04d6583eb858de486f4fc>:0)
MLAPI.Transports.UNET.UnetTransport.PollEvent (System.UInt64& clientId, System.String& channelName, System.ArraySegment`1[System.Byte]& payload, System.Single& receiveTime) (at <10b4ebfb14e04d6583eb858de486f4fc>:0)
MLAPI.NetworkingManager.Update () (at <10b4ebfb14e04d6583eb858de486f4fc>:0)

I am using the UNET transport, and the config.json is configured correctly (no CRC errors). I've also made no changes to the source code, i've only compiled it and am running the server on Linux

dylanpdx avatar Jan 04 '21 22:01 dylanpdx