Ullaakut / RTSPAllTheThings

Deprecated RTSP media server -- Use github.com/aler9/rtsp-simple-server instead.
Apache License 2.0
275 stars 72 forks source link

Memory leaks #77

Closed saloponov closed 4 years ago

saloponov commented 5 years ago

After 12 minutes of streaming, the container takes up more than 5 GB of RAM. All streams fell after memory overflow. I use next docker-compose file for creating stream:

image: ullaakut/rtspatt:latest
volumes:
  - "./camera-emulator/videos/:/videos/"
environment:
  RTSP_ADDRESS: 0.0.0.0
  RTSP_PORT: 19554
  RTSP_USERNAME: admin
  RTSP_PASSWORD: 123456
  RTSP_FRAMERATE: 30
  RTSP_RESOLUTION: 1280x720
  INPUT: /videos/cars.mp4
ports:
  - "19554:19554"
Ullaakut commented 5 years ago

Hi @saloponov,

Thanks for reporting this.

Have you been able to observe the containers for more than 12 minutes? RTSPATT has been running in production for over two years at my former company without any complaints about memory leaks, so I'm not convinced that there is a leak.

My guess is that memory usage simply increases as the videos you are streaming are buffered in the memory.

Let me know if you have some metrics over a longer time period that I could take a look at, and thanks for opening this issue :)

shubjain26 commented 4 years ago

Hi @Ullaakut ,

Thanks a lot for creating this, it's really helpful. As @saloponov mentioned, I am also observering memory leaks.

Within 5 mins, the container size reaches 10 GB

My Docker run command : docker run -it -e INPUT=/videos/vid.avi -vpwd/videos:/videos -p 8554:8554 ullaakut/rtspatt ########################## Container Log ##########################

Server configuration:
Address:    0.0.0.0
Port:       8554
Route:      /live.sdp
Username:   
Password:   
Auth method:    basic
Input:      /videos/khadim.avi
Input type: file

H264 encoding with:
Framerate:  2
Launching stream with the following pipeline: ( appsrc name=mysrc ! decodebin ! videorate ! video/x-raw,framerate=2/1 ! capsfilter ! queue ! x264enc speed-preset=superfast ! rtph264pay name=pay0 pt=96  )
Stream ready at rtsp://0.0.0.0:8554/live.sdp

Screenshot from 2020-03-26 00-58-23

Ullaakut commented 4 years ago

Hi @shubjain26, thanks for the detailed report! I am able to reproduce this issue, but it's unclear why it happens. I'm guessing it's some kind of issue with Gstreamer, I'll look into it when I have some time :)