socket.io
socket.io copied to clipboard
"Emit" leaks memory when using acknowledgement callback.
You want to:
- [x] report a bug
- [ ] request a feature
Current behaviour
When emitting message with acknowledgement callback, it starts leaking the memory.
Steps to reproduce (if the current behaviour is a bug)
// this will leak the memory ( with acknowledgements callback)
client.socket.emit('some_event', payload, (data) => {});
// this works fine
client.socket.emit('some_event', payload);
Expected behaviour
it shouldn't leak the memory
Setup
- OS: macOS High Sierra
- browser: Google Chrome 77.0.3865.90 (Official Build) (64-bit)
- socket.io version: ^2.0.4
Other information (e.g. stacktraces, related issues, suggestions how to fix)
To clearly see that it's leaking the memory please perform several thousand emits.
Could have 2 causes:
- The socket is in the
broadcastmode, where an error will be thrown and cause memory leak, though you should be able to see error messages on your server's console. - The ACK packet is never received (i.e. the client/server not handling the connections correctly), in which case the callbacks are registered but never invoked (meaning they will stick around forever, until an ACK is received), hence causing the leak.
I think case-2 is probably the actual cause of the problem you see.
Closed due to inactivity, please reopen if needed.