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

IndexOutOfRangeException in WebSocket Server #269

Open
invalidtask opened this issue Aug 25, 2023 · 1 comment
Open

IndexOutOfRangeException in WebSocket Server #269

invalidtask opened this issue Aug 25, 2023 · 1 comment

Comments

@invalidtask
Copy link

invalidtask commented Aug 25, 2023

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(ReadOnlySpan1 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()

@ilsnk
Copy link

ilsnk commented Oct 26, 2023

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants