Skip to content

[BUG] Possible memory leak with Obico ffmpeg video streaming #217

@calexandre

Description

@calexandre

I've been struggling with an instability issue on my OctoPrint instance, where, from time to time, the system runs out of memory. After some debugging, I managed to isolate the issue to the Obico plugin, specifically the ffmpeg process.

It seems that when I have the streaming enabled (which is the purpose of Obico), the ffmpeg process is automatically spawned and slowly consumes memory until OctoPrint crashes due to out-of-memory issues.

This process takes a few days before memory pressure starts causing instability in the entire system, eventually leading to OctoPrint crashing and failing the print.

I isolated this issue by letting the system run for some time with and without the Obico plugin enabled, which led me to open this issue.

To mitigate this problem, I set up a cron job to kill the ffmpeg process every day.

To Reproduce
Steps to reproduce the behavior:

  1. Enable Obico streaming.
  2. Monitor the ffmpeg process and check the memory it is consuming.
  3. After a couple of days, check the ffmpeg process and notice the sudden increase in memory. Depending on the interval, you may already be experiencing swapping problems due to a lack of available memory.
  4. If you don't kill the ffmpeg process, OctoPrint will eventually crash.

Screenshots

Day 0 - Enabled Obico streaming - ffmpeg is consuming almost 4% of memory, which is fine.

ffmpeg-day0

Day 1 - After 27 hours, the ffmpeg process is already taking up almost 30% of memory.

ffmpeg-day1

Desktop (please complete the following information):

  • OS: OctoPi 1.0.0 & OctoPrint 1.9.3 (new camera stack)
  • Browser: Chrome
  • Obico Version: 2.4.9

Additional context

  • I'm a paying customer of the Obico solution, so I have premium streaming enabled.
  • I don't know if it is related, but I reported another issue related to OctoPrint reporting lots of errors on the Obico plugin: link to the GitHub issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions