IndexOutOfRangeException in WebSocket Server
invalidtask opened this issue · comments
Unfortunately this is all the info I can get on this error. It seems to happen after a few minutes of running/few thousand connections. What is causing this error? Is there a way I can capture this exception if it's a rogue connection causing the entire thing to crash?
.NET 6 (.NET 7 is not supported on this machine)
NetCoreServer 6.0.7
Aug 25 04:50:04 ws_api[2715]: Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
Aug 25 04:50:04 ws_api[2715]: at NetCoreServer.WebSocket.PrepareSendFrame(Byte opcode, Boolean mask, ReadOnlySpan1 buffer, Int32 status) Aug 25 04:50:04 ws_api[2715]: at NetCoreServer.WsSession.SendPongAsync(ReadOnlySpan
1 buffer)
Aug 25 04:50:04 ws_api[2715]: at NetCoreServer.WsSession.SendPongAsync(Byte[] buffer, Int64 offset, Int64 size)
Aug 25 04:50:04 ws_api[2715]: at NetCoreServer.WsSession.OnWsPing(Byte[] buffer, Int64 offset, Int64 size)
Aug 25 04:50:04 ws_api[2715]: at NetCoreServer.WebSocket.PrepareReceiveFrame(Byte[] buffer, Int64 offset, Int64 size)
Aug 25 04:50:04 ws_api[2715]: at NetCoreServer.TcpSession.ProcessReceive(SocketAsyncEventArgs e)
Aug 25 04:50:04 ws_api[2715]: at NetCoreServer.TcpSession.OnAsyncCompleted(Object sender, SocketAsyncEventArgs e)
Aug 25 04:50:04 ws_api[2715]: at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
Aug 25 04:50:04 ws_api[2715]: --- End of stack trace from previous location ---
Aug 25 04:50:04 ws_api[2715]: at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute()
Aug 25 04:50:04 ws_api[2715]: at System.Threading.ThreadPoolWorkQueue.Dispatch()
Aug 25 04:50:04 ws_api[2715]: at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
Aug 25 04:50:04 ws_api[2715]: at System.Threading.Thread.StartCallback()
i have similar exception
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'length')
at System.Runtime.CompilerServices.RuntimeHelpers.GetSubArray[T](T[] array, Range range)
at NetCoreServer.WebSocket.PrepareReceiveFrame(Byte[] buffer, Int64 offset, Int64 size)
at NetCoreServer.TcpSession.ProcessReceive(SocketAsyncEventArgs e)
at NetCoreServer.TcpSession.OnAsyncCompleted(Object sender, SocketAsyncEventArgs e)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Net.Sockets.SocketAsyncEngine.System.Threading.IThreadPoolWorkItem.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()