Closed
Description
I initially reported this issue on ws repo, however there might be a possibility that it is a node issue after testing it on both the official windows Nodejs and Chakra builds. Somehow it seems that the issue can be reproduced more quickly on Linux/MacOS than on Windows.
Observations
- Slow clients (clients receiving data slower than server sends it) causes socket to increase their bufferSize
- This typically increases the RSS of the node process
- Upon disconnections of clients, we expect RSS to fall
- This is true for TCP test case but not for WS (Websockets)
- Slower RSS recovery for TCP test can be triggered by disconnecting most but not all of the connected clients
- Recovery of RSS can be sometimes triggered by connecting new clients and disconnecting them quickly
Reproduction Steps
- Test cases are in https://github.com/zz85/node-ws-slow-client-buffer-leak repository
- Run server on a separate machine over the network
- Run 200 clients for 30 seconds
- RSS builds up to approximately 700MB.
- Disconnects clients.
- RSS falls to about 300MB and stays there (RSS falls to 60MB for windows nodejs)