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 with new design #1542

Closed
mirenradia opened this issue Jan 30, 2021 · 8 comments
Closed

High CPU usage with new design #1542

mirenradia opened this issue Jan 30, 2021 · 8 comments

Comments

@mirenradia
Copy link

mirenradia commented Jan 30, 2021

Ever since the messenger.com update which broke lots of features (some of which were fixed in #1514), I have noticed CPU usage is much higher than it used to be. When my computer is [pretty much] idling, caprine is, more often than not, the process with the highest CPU usage (usually >50% as reported by top or htop) and almost always even more than my web browser (brave) with many open tabs. I am using:

  • Caprine v2.52.0 (amd64 deb package)
  • OS: Ubuntu 20.04
  • CPU: Intel Core i7-7700HQ

I am very unfamiliar with electron development but would be happy to help resolve this in any way I can.

@dusansimic
Copy link
Collaborator

Hi! Thanks for reporting this. We're already overflow with issues so we bight not be able to get to this right away. I'd still like to know as much as I can about this issue.

  • Do you have in the open chat any videos playing or animated images/gifs (that's usually the reason for high cpu usage)?
  • Is there a very active group chat in the background?
  • Does this issue exist in both Caprine and when you run Messenger website in browser (it'd be good to know if it related to chromium based browsers or is it any browser)?
  • What is the usual uptime of your machine and of Caprine.

Anyway, this is unusual behaviour for Caprine (I'm running v2.52 on Fedora with relatively low CPU usage) so we'll see what is going on. If there were no such problems before this, it might be related to Messenger website since there were very little changes in the Electron code (mostly if statements to check if something should be done for the new or old ui).

@mirenradia
Copy link
Author

We're already overflow with issues so we bight not be able to get to this right away. I'd still like to know as much as I can about this issue.

Thanks and no worries if it takes some time.

  • Do you have in the open chat any videos playing or animated images/gifs (that's usually the reason for high cpu usage)?
  • Is there a very active group chat in the background?

I guess CPU usage increases a bit then and that's to be expected. Even with no GIFs/videos/very active chats, I get this issue

  • Does this issue exist in both Caprine and when you run Messenger website in browser (it'd be good to know if it related to chromium based browsers or is it any browser)?

I just checked now and indeed brave has significantly lower CPU usage with messenger.com open (and focused).

  • What is the usual uptime of your machine and of Caprine.

I usually fully restart my system once or twice per week. I haven't noticed any patterns with the uptime of Caprine. Indeed, fully quitting and restarting Caprine does not resolve the issue.

If there were no such problems before this, it might be related to Messenger website since there were very little changes in the Electron code (mostly if statements to check if something should be done for the new or old ui).

I suspect that the new messenger UI is the issue. I should add that I also had this issue with the new messenger UI on older Caprine versions (e.g. v2.51.2) so I don't think #1514 is the issue.

I just tried removing and reinstalling Caprine but that did not resolve the issue either. I also tried the snap package (though I am generally not a fan of snaps) and the CPU usage seemed to fluctuate more here (though I only tested this briefly).

If it's helpful this is the output of ps -C caprine -o %cpu,%mem,cmd when nothing much is happening (open on a chat with no GIFs/videos/incoming messages):

%CPU %MEM CMD
 1.6  1.0 /opt/Caprine/caprine
 0.0  0.2 /opt/Caprine/caprine --type=zygote --no-zygote-sandbox
 0.0  0.2 /opt/Caprine/caprine --type=zygote
 0.0  0.0 /opt/Caprine/caprine --type=zygote
 4.7  0.7 /opt/Caprine/caprine --type=gpu-process --field-trial-handle=15160843671510268205,2066897863633412379,131072 --enable-features=WebComponentsV0Enabled --disable-features=CookiesWithoutSameSiteMustBeSecure,SameSiteByDefaultCookies,SpareRendererForSitePerProcess --gpu-preferences=MAAAAAAAAAAgAAAQAAAAAAAAAAAAAAAAAABgAAAAAAAQAAAAAAAAAAAAAAAAAAAACAAAAAAAAAA= --shared-files
 0.4  0.4 /opt/Caprine/caprine --type=utility --utility-sub-type=network.mojom.NetworkService --field-trial-handle=15160843671510268205,2066897863633412379,131072 --enable-features=WebComponentsV0Enabled --disable-features=CookiesWithoutSameSiteMustBeSecure,SameSiteByDefaultCookies,SpareRendererForSitePerProcess --lang=en-GB --service-sandbox-type=network --shared-files=v8_snapshot_data:100
61.7  1.5 /opt/Caprine/caprine --type=renderer --field-trial-handle=15160843671510268205,2066897863633412379,131072 --enable-features=WebComponentsV0Enabled --disable-features=CookiesWithoutSameSiteMustBeSecure,SameSiteByDefaultCookies,SpareRendererForSitePerProcess --lang=en-GB --app-path=/opt/Caprine/resources/app.asar --enable-plugins --no-sandbox --no-zygote --native-window-open --preload=/opt/Caprine/resources/app.asar/dist-js/browser.js --enable-remote-module --context-isolation --background-color=#fff --enable-spellcheck --enable-websql --disable-electron-site-instance-overrides --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=4 --no-v8-untrusted-code-mitigations --shared-files=v8_snapshot_data:100

@Amandaville
Copy link

Amandaville commented Jan 31, 2021

After reading this issue, I checked my cpu usage and found it to be much higher than expected as well.

$ ps -C caprine -o %cpu,%mem,cmd
%CPU %MEM CMD
 4.2  0.4 /opt/Caprine/caprine
 0.0  0.1 /opt/Caprine/caprine --type=zygote --no-zygote-sandbox
 0.0  0.1 /opt/Caprine/caprine --type=zygote
 0.0  0.0 /opt/Caprine/caprine --type=zygote
 4.2  0.4 /opt/Caprine/caprine --type=gpu-process --field-trial-handle=5708149057863618909,13040002005525943165,131072 --enable-features=WebC
 1.5  0.2 /opt/Caprine/caprine --type=utility --utility-sub-type=network.mojom.NetworkService --field-trial-handle=5708149057863618909,130400
40.5  0.6 /opt/Caprine/caprine --type=renderer --field-trial-handle=5708149057863618909,13040002005525943165,131072 --enable-features=WebComp
 0.0  0.0 /opt/Caprine/caprine --type=broker

This is the .deb install on Debian-based MX while sitting idle with no active message threads selected. I usually leave it on the "New Message" block when idle.

With this new information, I will be going back to running Messenger in a browser window or tab until this issue and the "Block Seen Indicator" have been resolved.

@dusansimic
Copy link
Collaborator

Thanks for all the info!

Seems like the Caprine renderer process is what is causing the high CPU usage. That is the process that handles the UI for the website (generates what you see on the app). Indeed, regular web browser (chromium based) doesn't have that problem.

This could be either related to Electron (however I've tried multiple different versions and I've got the same result) or it could be related to the new ui. Since I don't have that problem with the new ui in the browser, this is probably due to some code for old ui doing something on the new ui which is causing the high cpu usage.

Caprine is basically looking for elements on the website which don't exist and it might be doing some bad stuff along the way which is causing the cpu usage that we see. We'll see what changes when we fix all of the Caprines codebase to work on the new design.

I hope this is not causing too much trouble (clogging your system) but the only way I can see we make any progress right now is by fixing current issues caused by redesign.

@dusansimic dusansimic changed the title High CPU Usage with DEB package High CPU usage with new design Jan 31, 2021
@mirenradia
Copy link
Author

Yeah, I guess we'll have to see when other features are fixed with the new UI but I suspect you're right that it's looking for elements that don't exist with it.

@mirenradia
Copy link
Author

I briefly tried 2.52.1 and still had the same issue.

@Tuxino88
Copy link

No VA-API no party XD

@lefterisgar
Copy link
Collaborator

Closing, as it will probably be fixed in the next release.

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

No branches or pull requests

5 participants