So I have a route on express that serves up video, I simplified the route as much as possible, but for some reason there appears to be a memory leak when using Ubuntu.


Post image

Notice All The Spawned Node Instances Using 51%

Usually the RAM will sit at about ~250, none of my other routes have this issue, and it seems to be specific to Linux/Ubuntu (my VPS is on Ubuntu 18.04), because on my Mac the memory always goes back down, and I did a heap size check, and it always returned around 30mb on my Mac. I only have a VPS on digitalocean and I cannot figure out how to get the debugging working from there. But as you can see the ram will steadily go up, and it won’t seem to ever go back down. Eventually I will get a RAM allocation error if I let the video stream long enough.

It’s worth noting that the demo only comes with a 5MB video, I recommend using at least a 200mb video if you’d wish to try this, just add any video to the root of the project, and rename it too ‘bunny.mp4’. Also you will notice in my code I attempt to kill the route if its rerequested (things like users scrubbing can cause way to many streams to be running at once, so I kill the old streams if a new one is spawned). But even If i remove this logic the memory issue still remains regardless.

Source link

Write A Comment