illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
5.91k stars 1.51k forks source link

possible memory leak #448

Open docete opened 3 years ago

docete commented 3 years ago

Use NMS as a RTMP server in docker and push 2 rtsp streams to NMS(using ffmpeg). After running 2 days, the docker container crashed. No signnificant errors in docker logs, but find the oom killer kill the node process.

[1243919.280838] Out of memory: Killed process 2632130 (node) total-vm:14075452kB, anon-rss:13760044kB, file-rss:0kB, shmem-rss:0kB, UID:0 [1243920.030207] oom_reaper: reaped process 2632130 (node), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB

Then I restart the docker container, push 1 rtsp stream to NMS, and find a minor but continuous increase in RES.

BTW: I use the latest version of NMS images:

illuspas/node-media-server latest 820b200d9fc1

docete commented 3 years ago

After runing 3 hours, the RES increased to 5GB (from hundreds of MB)

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND

3161337 root 20 0 5750156 5.1g 33388 S 7.3 26.3 8:54.81 node