Gladys RAM usage

Yes, there is clearly an issue, in my opinion:

  • either a ffmpeg bug introduced in a recent version of ffmpeg
  • or a change in the ffmpeg API that we haven’t integrated into Gladys
  • or a change in Node 18 in the handling of child processes

We need to investigate; I haven’t had time on my side yet, I’d welcome help on the topic :slight_smile:

Edit: For info we use this lib in Gladys:

After seeing all the reported issues (295 issues), and the fact that the lib is no longer really maintained, for what it does we’d be better off just launching ffmpeg ourselves via a Node child process so we can close it properly

That was originally a feature (and not a bug)

The idea is to always have a fresh image in memory so that if you open the dashboard, you immediately have a fresh image served from memory, and you don’t have to wait for a new image to be fetched.

1 Like

Which is in itself a good idea, but the CPU impact is quite high. I can’t imagine if you connect 5 cameras or more to Gladys.
On my machine (mini-PC) I went from an average of 6% to 50% or even 70% (image every 10 seconds).

To save on performance, Gladys could update in the background, but only once a minute as long as no dashboard is loaded?
Anyway, that’s a minor detail here, given the other, much more important bug!

[quote=« lmilcent, post:43, topic:7821 »]
To reduce the performance impact, Gladys

That’s the purpose of this setting « 1 minute/30 seconds/10 seconds » etc.. originally :slight_smile:

There you are using this setting to create a fake semblance of live on the dashboard, but it’s too resource-hungry because it’s not really made for that ^^

For live updates on the dashboard, I agree it’s a nice enhancement to add and to develop properly :slight_smile:

2 Likes

Hi everyone!

I’m picking up this topic that had been forgotten; there wasn’t a GitHub issue :sweat_smile:

I worked this morning on replacing the ffmpeg-fluent library, which is clearly outdated and is the likely cause of this memory leak.

I’m replacing it with a simple child_process which will then be released from memory once the camera image is retrieved.

The PR is here:

Sorry again for the delay, please don’t hesitate to nudge me on topics like this if there’s no activity, and above all remember to create a GitHub issue (GitHub · Where software is built), it’s the « TODO list » of bugs to fix for the project :slight_smile:

2 Likes

And if the image is never retrieved, what happens?
From what I remember it was another cause of my problem — a memory leak when the camera is no longer available.

The command times out after 10 seconds without a response, and then the child_process is killed, so no more memory leak :slight_smile:

1 Like

This thread has been posted in Gladys Assistant 4.47.0 :slight_smile:

I’d be curious to hear your feedback after the update, especially @spenceur!

@spenceur Have you been able to monitor your RAM usage a bit since 4.47?

No, sorry I clearly didn’t have time ^^

1 Like