Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

high CPU usage #199

Open
pasnox opened this issue Sep 21, 2024 · 22 comments
Open

high CPU usage #199

pasnox opened this issue Sep 21, 2024 · 22 comments

Comments

@pasnox
Copy link

pasnox commented Sep 21, 2024

I have since some times now an issue where my rpi5 fan would spin at 50% (loud noise) instead of 25% (no noise) every 5 or 10 minutes. Initially I thought it was related to the PVR Freebox extension which updates its guide every 5 minutes, but it's not, disabling it still has the issue.
I noticed my fan spinning fast because the RPI reached 60-62° when idling which is weird because to be honest the skin is so simple nobody can imagine that. Then I tested other skins, like the default estuary where the issue disappeared and reached a steady 54-55° when idling and no more issues.
I can't imagine a so simple skin needing so much CPU just to change every 30 secs a background image. Would you mind having a look at this issue?
As of now I returned to estuary because of the permanent noise it triggers, which is very annoying - your skin being so much good!

@pasnox
Copy link
Author

pasnox commented Sep 21, 2024

I'm using LibreElec 64bits:
LibreELEC:~ # /usr/lib/kodi/kodi.bin --version
Kodi Media Center 21.1 (21.1.0) Git:21.1-Omega
Copyright (C) 2005-2021 Team Kodi - http://kodi.tv

@realcopacetic
Copy link
Owner

Do you know what screens it was on when it was doing this? If it was the background service that fetches fanarts, it should only be running on screens where you see the slideshow background. do you get this noise if you leave it idle in your movies folder or somewhere where the background service isn't running? You could also try disabling the clearlogo cropper in skin settings as that runs in the background. I'm trying to make some optimisations to the background fanart fetcher to make it more efficient, I'll try to push these updates out soon

@pasnox
Copy link
Author

pasnox commented Oct 7, 2024

It would be screen agnostic, I've reproduced it everywhere.
But I may have found the issue, I have many USB powered USB devices attached to the RPI, 2 HDD one is the boot disk and a Chromecast , so it would heat a lot from there. I removed the Chromecast and it seems to reduce the heat, and then the fan noise.
I will confirm in a week or so.

@pasnox
Copy link
Author

pasnox commented Oct 7, 2024

Ok I was wrong, USB devices are unrelated.
Tested again this morning in Idle in main page for copacetic and estuary and there is a steady ~10° difference between both.
Estuary stays around 52-54° while copacetic after 3 minutes reach a steady 61-63°.

@pasnox
Copy link
Author

pasnox commented Oct 7, 2024

Do you know what screens it was on when it was doing this? If it was the background service that fetches fanarts, it should only be running on screens where you see the slideshow background. do you get this noise if you leave it idle in your movies folder or somewhere where the background service isn't running? You could also try disabling the clearlogo cropper in skin settings as that runs in the background. I'm trying to make some optimisations to the background fanart fetcher to make it more efficient, I'll try to push these updates out soon

While there please increase the slideshow interval, I would prefer being able to change any 10/15/30 minutes instead

@realcopacetic
Copy link
Owner

Mine will be more resource hungry than Estuary because of the extra stuff going on and the fact I don't use the standard containers for views (instead they are manually coded and animated - this is more resource-intensive, but allows for greater freedom in animations).

If you want to bring the temp down, you can disable any features you aren't using in skin settings, e.g. anything in Extras, views you don't want.

I added in 2.6.6 the longer slideshow durations. Using those might bring the temperature down as well, as Kodi won't query the database as often to fetch fanarts.

Alternatively, if you don't mind editing a file, you could remove from addon.xml the line that says

""

You may see some error messages but this will tell us if the issue is with the script running in the background or with the skin itself.

If it's the script, the two main things it's doing in the background during normal operation are clearlogo cropping (which you can disable in skin settings) and the background slideshows, which can't currently be disabled. I could make an option to disable this if it is the script, but then you'd be left with black screens

@pasnox
Copy link
Author

pasnox commented Oct 8, 2024

If you want to bring the temp down, you can disable any features you aren't using in skin settings, e.g. anything in Extras, views you don't want.

I'm pretty much using the default setup already.
Would copacetic warn if we try to disable a view being used?

I added in 2.6.6 the longer slideshow durations. Using those might bring the temperature down as well, as Kodi won't query the database as often to fetch fanarts.

I can only see 2.6.5 in your repository.

Alternatively, if you don't mind editing a file, you could remove from addon.xml the line that says

""

You may see some error messages but this will tell us if the issue is with the script running in the background or with the skin itself.

Which addon.xml file are we speaking?

If it's the script, the two main things it's doing in the background during normal operation are clearlogo cropping (which you can disable in skin settings) and the background slideshows, which can't currently be disabled. I could make an option to disable this if it is the script, but then you'd be left with black screens

Will check, I don't want to disable the slideshow, i very like it.

@pasnox
Copy link
Author

pasnox commented Oct 8, 2024

After verification, all things I don't use are already disabled, and clearlogo cropping is already disabled 😞
I will see when 2.6.6 will be released with longer slideshow duration

@realcopacetic
Copy link
Owner

realcopacetic commented Oct 8, 2024

Ok I'll try to push 2.6.6 out tonight if I have itme,

I also reduced the number of fanarts fetched from 40 to 20, hopefully that will mean a bit less stress on CPU

@pasnox
Copy link
Author

pasnox commented Oct 8, 2024

Do you know what screens it was on when it was doing this? If it was the background service that fetches fanarts, it should only be running on screens where you see the slideshow background. do you get this noise if you leave it idle in your movies folder or somewhere where the background service isn't running? You could also try disabling the clearlogo cropper in skin settings as that runs in the background. I'm trying to make some optimisations to the background fanart fetcher to make it more efficient, I'll try to push these updates out soon

That indeed seems like the slideshow powered views that increase heat and CPU usage.
When hanging in the movie folder the CPU usage is similar to estuary

@pasnox
Copy link
Author

pasnox commented Oct 9, 2024

So, i bumped to 2.6.7 and moved to 15minutes slideshow duration, to not get any better result.
I also disabled the import in the addon.xml file and restarted Kodi but it did not changed anything as well.
Note that even with disabling the import the slideshow would continue to work, is this expected?

@realcopacetic
Copy link
Owner

Removing that import line means the skin is now allowed to run without the script dependency. Now in addons you can disable script.copacetic.helper,

@pasnox
Copy link
Author

pasnox commented Oct 10, 2024

So commenting the import and disabling the helper make the CPU usage lowering after restarting Kodi. So it seems the script is to incriminate.

@realcopacetic
Copy link
Owner

So commenting the import and disabling the helper make the CPU usage lowering after restarting Kodi. So it seems the script is to incriminate.

I'll try refactoring the code to see if I can figure out anything else to optimise. Have you used any of the Arctic Horizon or Arctic Fuse skins? I wonder if they have a similar footprint as they are doing many of the same things

@pasnox
Copy link
Author

pasnox commented Oct 11, 2024

I will have a look

@realcopacetic
Copy link
Owner

Nearly finished with this. Will try and push the update in the next day or two

@pasnox
Copy link
Author

pasnox commented Oct 22, 2024

done? which version I'm supposed to see the enhancements?

@realcopacetic
Copy link
Owner

Sorry I've not managed to finish it yet. We just had a baby which has nixxed any freetime for the moment!

@realcopacetic
Copy link
Owner

I might have a bit of time later so I'll try and finish if I can. It ended up being a bit of a rewrite of the python code, which is why it's taken longer

@realcopacetic
Copy link
Owner

Refactoring of the art handler is complete. I just need to test it a bit then will push the update

@realcopacetic
Copy link
Owner

Hi I pushed the update, please let me know if it improves anything or if you encounter any errors.

@pasnox
Copy link
Author

pasnox commented Nov 20, 2024

Unfortunately, after intensive tests this does not help much. The CPU usage is sensibly the same.
I suppose we should close the ticket as there is pretty much nothing more you can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants