sta / sta/websocket-sharp

Fatal Https Server Crash on MobileAuthenticatedStream Error

Open
#744 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading WebSocket., Ext.ReadBytesAsync, and WebSocketFrame.processHeader from the stack traces. Investigate how a disposed MobileAuthenticatedStream and unread frame headers are handled during HTTPS server reception. Done means reproducing the failure or identifying a reliable trigger and preventing it from fatally stopping the server.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.