sta / sta/websocket-sharp

WebSocketServiceManager.Broadcast() gets stuck if one of clients stops reading from socket

Open
#394 1 comment 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

Problem description:
One of our web socket clients for some reason stopped receiving messages(Some bug in our client code). This stopped message delivery to all other clients. After investigating this issue we saw that WebSocketServiceManager.Broadcast() got stuck on delivery to that buggy client for 5+ hours.

Steps to reproduce:

  1. Start WebSocketServer
  2. Connect to WebSocket from client(without Receive)
  3. Start loop with WebSocketServiceManager.Broadcast(/1KB/) with 10000 iterations

Actual result:
WebSocketServiceManager.Broadcast() got stuck on 172th iteration

Expected result:
Loop should complete successfully

Proposed solution:
Add property WebSocket.SendTimeout to limit sending message into socket.

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 at WebSocketServiceManager.Broadcast() and reproduce the issue with a client that does not receive messages, using the 1KB payload and 10,000 iterations described here. Done means a stalled client no longer prevents the broadcast loop from completing, with the sending behavior covered by a reproducible check.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.