hama3254 / Crunchyroll-Downloader-v3.0

Downloader for Crunchyroll
835 stars 110 forks source link

High CPU load when idling #462

Closed RonBergbauer closed 2 years ago

RonBergbauer commented 2 years ago

I noticed that CRD ends up using a lot of CPU while it shouldn't be doing anything.

It's hard to pinpoint when this is happening. I see this behavior mostly after a download queue is processed. Then although the queue is finished and all files are written, I see a CPU load way above average.

For example right now after a fresh start CRD is using 0% CPU and 34MB RAM. After a download most of the time CRD is hovering at 1-2% and 300-500MB. But from time to time it sits at 15% CPU load while doing nothing.

It look like some processes and resources aren't closed at the end of the downloads. Observed with Chromium U14 version on Win10 Pro.

hama3254 commented 2 years ago

I know that i need to find a way to close the embedded webbrowser while it's not needed without causing any problems. My guess would be that the RAM usage comes from the cefsharp subprocesses and the CPU usage could also be something the browser does which might depende on the webbsite. Also for the CPU usage it would be nice to know what your hardware is since 15% of an 10 year old CPU vs something new would be a differnce.

RonBergbauer commented 2 years ago

I'm running this on my desktop pc, which is a Intel NUC with a i5-8259 4 core, 8 threads. Not high-end, but should be more than enough in this use case. And I'm just running 3 parallel downloads.

RonBergbauer commented 2 years ago

Screenshot 2022-04-19 121550 This happend after a processing a longer queue. No more downloads, no processing happening. There were errors while processing the queue (out of bounds errors - likely due to long filenames) and one "resolution not found" interruption. I'll check if this also happens if there are no errors.

hama3254 commented 2 years ago

i just tried a full 12 episode season with the queue (via the add-on) i don't see more than 1% usage after it has finished which is far away from what you describe even accounting for the difference in CPU power from your 8 Gen Intel to my 12 Gen Intel chip.

I keep an eye on that since usually i stop the downloader in case of an issue to see what went wrong so i don't get the normal user experience.

For you i would recomment to upgrade i just added v3.8.5 to roll out the cefsharp 100.0.140.0 since that could also be an performance issue.

RonBergbauer commented 2 years ago

I just finished a queue download with your latest version 3.8.6 and I still see the same behavior. The queue is finished and CRD is idling at 12% cpu load.

hama3254 commented 2 years ago

even after a very long test queue i don't see any issues, i just use 360p to make it faster but the downloader has to do the same task for every resolutions so it should not matter grafik

bybpow commented 2 years ago

Do you use hybrid? Maybe is that why you see that much usage.

RonBergbauer commented 2 years ago

Yes, I do. But I just tried without hybrid mode (default - ffmpeg) and it's the same behavior. Before download with added items in the queue 0% idle usage. After download > 10% in idle, with the the same split as in my screenshot above. Most usage in the CRD process, all CefSharp Subprocesses still open and two of them doing something.

bybpow commented 2 years ago

That is a "high" CPU but I guess this depends on the model itself. I don't replicate this issue. After downloading, when idling it stays around 2%, probably because the browser is still opened.