sta / sta/websocket-sharp

Cannot access a disposed object on CloseHandshake

Open
#9 2 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

Hi,
I'm testing a client/server combo and I'm having 2 issues:

  1. If I exit the client application, I'm getting a "Cannot access a disposed object" on the CloseHandshake method (well, really, on the SendWsFrame, when the method tries to call the WriteFrame sub-method). It seems that the innerStream is being disposed, but I'm not sure why. I already put a breakpoint on the Dispose method of the WsStream class and it is not being invoked.

  2. Since the client doesn't correctly close the connection, the server doesn't receives any notifications about this now missing client. That's ok, but I believe there should has to be some sort of timeout on the server so, if a client doesn't reports back in a timely period, the server automatically remove that client from the active client list.

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 tracing CloseHandshake through SendWsFrame and WriteFrame, then inspect WsStream.Dispose and the innerStream lifecycle. Separately review how the server tracks its active client list. Done means client shutdown no longer raises the disposed-object error and disconnected clients are removed after the reported timeout condition.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.