socketio / socketio/socket.io

Heartbeat timeout is no longer reset on packet

Open
#5,450 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs investigation
Dominant language
TypeScript
Stars
63.2k
Forks
10.3k
Avg merge
11d 20h
Merged PRs (30d)
2

Description

Describe the bug
We have a high volume of data incoming from our sockets and they get disconnected at PingInterval+Timeout s with a ping timeout because the server has not received a pong, however it has received other messages from these sockets.

Image

Note how some connections drop after ~40seconds and reconnect.

There was a fix for this in https://github.com/socketio/engine.io/commit/be7b4e7478132a9409603327b27d1aa1970dd1d9 which got reverted in https://github.com/socketio/socket.io/commit/5359bae683e2a25742bd4989d0355a8fc10d294e

While I understand the "wastefulness" of creating timers on every packet, I still think the point of the socket being very much alive if there is data coming from it is valid (even when the pong packages is coming through timely).

Is there a chance to revert the revert?

To Reproduce

Please fill the following code example:

Socket.IO server version: 4.x

Send a lot of packages from the client, watch them disconnect after ~40 seconds even when data is coming from them.

Expected behavior
Connections should not be considered stale if there are still packets coming.

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

Start by tracing the Socket.IO server heartbeat timeout handling and compare it with the referenced engine.io fix and subsequent revert. Reproduce the issue by sending a high volume of client packets, then verify that connections remain alive when packets continue arriving instead of disconnecting after the ping interval and timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend-api-design, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.