Description
- Version: v10.4.1
- Platform: Windows 10 x64, Ubuntu 18.04 x64
- Subsystem: http2
Hi, this is my first bug report for node, hopefully i get it right!
TLDR: http2session.request appears to be leaking memory outside of javascript (heap is clean, resident set size keeps growing).
I am attaching a rather crude test code which demonstrates the issue and is able to repro it every time.
The zip file attached contains client.js, server.js and "keys" folder containing self signed SSL keys.
- start the server (it will be running on port 8080)
node server.js
- start the client
node --expose-gc client.js
- let the client run for a little while
Depending on the performance of your machine, you should see the "test output" in < 15 seconds or so.
What happens
- client will establish connection to the server and make 1 request
- after we get a reply we save current
process.memoryUsage()
for later comparison - client will send 5 parallel requests 20 000 times to the server, 100k total
- we will trigger GC and wait for 10 seconds, then trigger GC again (i need heapTotal to shrink and this seems to work)
- we will grab the latest
process.memoryUsage
and calculate the delta for rss, heapTotal and heapUsed
You should get an output similar to this
Deltas: 0 KB Heap Total, -52 KB Heap Used, 10436 KB RSS
Feel free to play with the amount of requests you make, obviously higher number takes longer to execute but leaves much higher rss.
Here is a graph of rss, heap total and heap used over 24h on a system that does ~30k> requests per day, it has been running for several days (hence the larger rss).
Sorry i wasn't able to narrow it down any further (took me over a month to trace the issue this far in my system as it kept leaking rather slowly and doing heap snapshot comparison never revealed anything).