Skip to content

Conversation

@seungeonchoi
Copy link

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behavior

When using emitWithAck with a timeout, if clients don't respond and the timeout triggers, the ack callbacks remain in socket.acks Map indefinitely, causing a memory leak.

New behavior

The ack callbacks are cleaned up from socket.acks Map when the timeout occurs, preventing memory leak.

Other information (e.g. related issues)

Fixes #4984

When using `emitWithAck` with a timeout, if clients don't respond
and the timeout triggers, the ack callbacks remain in `socket.acks`
Map indefinitely, causing a memory leak.

This fix:
- Returns a cleanup function from `broadcastWithAck` that removes
  pending acks from all sockets that received the packet
- Calls the cleanup function when timeout occurs in broadcast-operator
- Adds test cases to verify acks are cleaned up after timeout

Fixes socketio#4984
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"emitWithAck" function leaks memory when acknowledgement timeout

1 participant