socketio / socketio/socket.io

Socketio client keeps reconnecting after ping timeout, even after exhausting all reconnection attempts

Open
#5,116 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation package:socket.io-client
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

Describe the bug
What we observes :

  • Some of our users disconnect with a "ping timeout" logged server side
  • They try to reconnect multiple times using their current sid, but the server respond with a 400 (Session ID unknown). We have set reconnectAttempts to 3 and they seem to exhaust all the attempts.
  • They try to reconnect with a new sid
  • They encounter another ping timeout, and it starts all over again

And this goes on and on and on. Some of our users are making more than 100 000 requests a day to our websockets server only to do all those reconnections.
We noted that the impacted clients seems to exclusively use long-polling and never upgrade to websocket

What I do not understand is why does the socketio client try to connect with another sid after exhausting the 3 reconnection attempts.

To Reproduce

We managed to reproduce the problem by using a Chrome browser and limiting the bandwith to 1kb/s.

Socket.IO server version: 4.6.0
Socket.IO client version: 4.6.0

Expected behavior
We expect the reconnection to stop after exhausting all the reconnect attempts

Platform:

  • OS: Docker image built on top of node:16-alpine

Contributor guide

Open the contributing guide

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

Reproduce the loop in Chrome with bandwidth limited to 1kb/s using Socket.IO 4.6.0, then trace the client reconnection handling; the issue names no source file or test. Done means a client stops reconnecting after the configured three attempts, including after a later ping timeout, with coverage for the long-polling scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.