sta / websocket-sharp

A C# implementation of the WebSocket protocol client and server

Home Page:http://sta.github.io/websocket-sharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fatal Https Server Crash on MobileAuthenticatedStream Error

simontuffley opened this issue · comments

I have recently been experiencing random crashes which have caused the HTTPS server to completely stop functioning. I have not managed to find a pattern as to how and why this may be happening. Do you have any suggestions on a fix/workaround to stabilize my application?

Below is the exact error that causes the Fatal crash:

01/24/2024 23:49:04|Fatal|WebSocket.b__176_2|System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'MobileAuthenticatedStream'.
at Mono.Net.Security.MobileAuthenticatedStream.StartOperation (Mono.Net.Security.MobileAuthenticatedStream+OperationType type, Mono.Net.Security.AsyncProtocolRequest asyncRequest, System.Threading.CancellationToken cancellationToken) [0x0024b] in <1c78b69854d1484f990a794c04802348>:0
at System.Threading.Tasks.TaskToApm.End[TResult] (System.IAsyncResult asyncResult) [0x0002f] in <2ad40006e9c141b299c9c7c533021a74>:0
at System.Net.Security.SslStream.EndRead (System.IAsyncResult asyncResult) [0x00000] in <1c78b69854d1484f990a794c04802348>:0
at WebSocketSharp.Ext+<>c__DisplayClass48_0.b__0 (System.IAsyncResult ar) [0x00000] in <7de3ebfa4f374e6aaec939c3ef521f2f>:0

Also, just in case it is related to the above issue, I am receiving these Fatal errors. However, the application can recover from them. If you have advice it would be greatly appreciated:

01/16/2024 13:05:21|Fatal|WebSocket.b__176_2|WebSocketSharp.WebSocketException: The header of a frame cannot be read from the stream.
at WebSocketSharp.WebSocketFrame.processHeader (System.Byte[] header) [0x00010] in <7de3ebfa4f374e6aaec939c3ef521f2f>:0
at WebSocketSharp.WebSocketFrame+<>c__DisplayClass73_0.b__0 (System.Byte[] bytes) [0x00000] in <7de3ebfa4f374e6aaec939c3ef521f2f>:0
at WebSocketSharp.Ext+<>c__DisplayClass48_0.b__0 (System.IAsyncResult ar) [0x00085] in <7de3ebfa4f374e6aaec939c3ef521f2f>:0