network icon indicating copy to clipboard operation
network copied to clipboard

fix(dht): `WebsocketServer` memory leak

Open teogeb opened this issue 2 years ago • 0 comments

Improve WebsocketServer cleanup. When we explicitly remove httpServer listeners, the instance doesn't leak memory immediately after WebsocketServer#stop is called.

There wasn't a permanent memory leak: e.g. await wait(100) before the check in the unit test would also make the test pass.

Open questions

Why the change causes this tests to fail:

dht-browser:

1) starts and stops
     WebsocketServer
     ReferenceError: require is not defined

teogeb avatar Nov 20 '23 09:11 teogeb