Open
Description
Describe the bug
When using "emitWithAck" on the server side, the memory is not freed when the acknowledgement timeout is reached.
I tested on 500 client connections, and the memory usage is 1557MB after 3 hours.
Steps:
- Connect 500 clients, 10 clients per room, 50 rooms
- The first client in each room sends a message to the room every second(use emitWithAck)
- Each client does not call callback after receiving a message(simulation timeout)
- Memory usage is not freed
To Reproduce
Socket.IO server version: 4.7.2
Server
try{
const responses = await socket.timeout(2000).to("room1").emitWithAck("event", "message");
} catch(err){
}
Socket.IO client version: 4.7.2
Client
socket.on("event", (data, callback) => {
// Do not call callback, simulation timeout.
// callback(1);
});
Expected behavior
Should not leak memory
Platform:
- Server Node.js version:
18.18.0
- Client Node.js version:
18.18.0
- OS:
win 10
Additional context
See broadcast-operator.ts timer, it seems that when timeout, ack function is not deleted from socket.acks.