sindresorhus / caprine

Elegant Facebook Messenger desktop app
MIT License
6.97k stars 549 forks source link

High CPU usage #2023

Open donluca opened 1 year ago

donluca commented 1 year ago

Caprine, while not doing nothing, is using 12% of my CPU.

This is way too much and it's inexcusable as I'm not using it, I'm not messaging, there are no GIFs or videos playing or anything.

rosoau commented 1 year ago

Same here. It freezes up while typing and needs to be restarted again. In between it works though.

dusansimic commented 1 year ago

What are the specs of the machine you're using? Electron (the framework Caprine is made with) tends to be more resource intensive than other frameworks.

donluca commented 1 year ago

Base model Mac Mini M1, 8GB RAM (30% free, not swapping) and 128GB HD

dusansimic commented 1 year ago

Are you using Apple Silicon variant or the Intel variant and running on Rosetta?

donluca commented 1 year ago

Apple Silicon

archerallstars commented 1 year ago

I am on openSUSE Tumbleweed, Caprine Flatpak. My CPU is Intel i5-8250U. I also have this issue randomly. Once this happens, the UI becomes unresponsive.

Invactive commented 1 year ago

Same very high CPU usage happens on Linux Mint 21.1 and Intel i5-8300H.

WillMatthews commented 1 year ago

Uses up an entire thread on my machine (!) Ubuntu 22.04 with Ryzen 5 3600X

cbeley commented 11 months ago

This occurs quite often for me as well on Linux. Doesn't really impact usage of my machine (i7-1260P), but I know it's time to restart caprine with I hear the CPU fans whirring while my machine is otherwise idle.

stuckj commented 11 months ago

Same as @cbeley on ubuntu 22.04. I have the same processor in my laptop and the fans are almost always silent. When they spin up the first thing I look for in top is caprine. If it's at 100% I restart it and it resolves. It also doesn't appear to have the latest chat updates when this happens as there are new chat messages after restarting. Seems hung on some update process.

stuckj commented 11 months ago

I've, in fact, determined this happens on EVERY new message received in caprine for me. I'm using 2.58.1 from the snap store. I'll try the 2.58.1 AppImage from github and see if it's a snap-specific issue.

stuckj commented 11 months ago

Happens with the 2.58.1 AppImage as well. So, it doesn't appear to be a snap-related issue. At least it's easy to trigger the issue. Any place I can record debug info or anything. I'm happy to help debug it. I'm a dev and currently work on react-native and react with gatsby though never with electron. :-P Any pointers on where to look at debug logs or debugging electron apps?

stuckj commented 11 months ago

The 2.58.0 AppImage works fine. This appears to be a regression in 2.58.1 (at least, for me). At least the diff looks pretty small: https://github.com/sindresorhus/caprine/compare/v2.58.0...v2.58.1#

I noticed there's no deb for the latest 2.58.1 release also. Not sure why.

stuckj commented 11 months ago

Happened on 2.58.0 now as well. I see now looking in the issues that there are lots of related issues (involving lockups) and the consensus appears to be that it's from the messenger website (since caprine's just rendering that in electron). I'll try the website directly in brave (which is also chromium-based) and see if it's happening in there too. Sounds like it's something FB has to fix...though it looks to have been a year so kinda surprising they'd leave something like that broken so long. :-P

archerallstars commented 11 months ago

I have never seen this issue when using Facebook Messenger on the web in Chrome or Brave. The reason I use Caprine is because I try Firefox, which doesn't work with Messenger at all. Then, this issue occurs right away.

Now, I don't use Firefox anymore, I am on Brave using Facebook Messenger is no longer an issue. I open the window all the times as a PWA. I have never seen high CPU usage.

Alex313031 commented 10 months ago

@kreaninw @stuckj @cbeley Might be an Electron issue, can you try my fork with Electron 22 > https://github.com/Alex313031/caprine-ng

jkugler commented 7 months ago

Now Caprine is using 75% to 100% of a CPU core.

Version 2.59.1 $ uname -a Linux hosanna2 6.6.6-76060606-generic #202312111032~1702306143~22.04~d28ffec~dev-Ubuntu SMP PREEMPT_DY x86_64 x86_64 x86_64 GNU/Linux

cbeley commented 7 months ago

Interestingly, it was ok for quite a while, but last week or two I've started noticing my fans whirring up again. Sure enough, it was Caprine.

mirenradia commented 7 months ago

I've also noticed that this has become more a problem in the last few days on v2.59.1. I've noticed that the process which seems to be using the most CPU resources has --type=renderer:

$ ps -C caprine -o %cpu,%mem,cmd
%CPU %MEM CMD
 0.0  0.4 /usr/lib64/caprine/caprine --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --ozone-platform=wayland
 0.0  0.1 /usr/lib64/caprine/caprine --type=zygote --no-zygote-sandbox
 0.0  0.1 /usr/lib64/caprine/caprine --type=zygote
 0.0  0.0 /usr/lib64/caprine/caprine --type=zygote
 0.6  0.2 /usr/lib64/caprine/caprine --type=gpu-process --ozone-platform=wayland --enable-crash-reporter=671ad309-5663-461d-9c4b-8be054ed217c,no_channel --user-data-dir=/home/miren/.config/Caprine --gpu-preferences=WAAAAAAAAAAgAAAYAAAAAAAAAAAAAAAAAABgAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAOAAAAAAAAAAAAAAAAAAAABAAAAABAAAACAAAAAAAAAAQAAAAAAAAAAAAAAAEAAAACAAAAAAAAAAIAAAAAAAAAA== --shared-files --field-trial-handle=0,i,6472731342252676630,8635904168276324115,131072 --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --disable-features=SpareRendererForSitePerProcess
 0.0  0.1 /usr/lib64/caprine/caprine --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-GB --service-sandbox-type=none --enable-crash-reporter=671ad309-5663-461d-9c4b-8be054ed217c,no_channel --user-data-dir=/home/miren/.config/Caprine --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,6472731342252676630,8635904168276324115,131072 --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --disable-features=SpareRendererForSitePerProcess
22.7  0.8 /usr/lib64/caprine/caprine --type=renderer --enable-crash-reporter=671ad309-5663-461d-9c4b-8be054ed217c,no_channel --user-data-dir=/home/miren/.config/Caprine --app-path=/usr/lib64/caprine/resources/app.asar --no-sandbox --no-zygote --ozone-platform=wayland --lang=en-GB --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=6 --time-ticks-at-unix-epoch=-1705484196745031 --launch-time-ticks=1391179521 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,6472731342252676630,8635904168276324115,131072 --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --disable-features=SpareRendererForSitePerProcess
 0.0  0.1 /usr/lib64/caprine/caprine --type=renderer --enable-crash-reporter=671ad309-5663-461d-9c4b-8be054ed217c,no_channel --user-data-dir=/home/miren/.config/Caprine --app-path=/usr/lib64/caprine/resources/app.asar --enable-sandbox --ozone-platform=wayland --lang=en-GB --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=7 --time-ticks-at-unix-epoch=-1705484196745031 --launch-time-ticks=1391694286 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,6472731342252676630,8635904168276324115,131072 --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --disable-features=SpareRendererForSitePerProcess
 0.0  0.1 /usr/lib64/caprine/caprine --type=utility --utility-sub-type=audio.mojom.AudioService --lang=en-GB --service-sandbox-type=none --enable-crash-reporter=671ad309-5663-461d-9c4b-8be054ed217c,no_channel --user-data-dir=/home/miren/.config/Caprine --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,6472731342252676630,8635904168276324115,131072 --enable-features=UseOzonePlatform,WebRTCPipeWireCapturer --disable-features=SpareRendererForSitePerProcess

Presumably there are some server side changes which Caprine has not been updated for.

I'm running Fedora 39 KDE on kernel 6.6.11.

jkugler commented 7 months ago

My "solution." (In Chrome)

  1. Go to https://www.messenger.com/
  2. Click on the "three dot" menu (Top right)
  3. Click "Save and Share"
  4. Click "Create Shortcut..."
  5. Name it "Facebook Messenger", check "Open as window," and click "Create."

You now have a Messenger "app."

archerallstars commented 7 months ago

@jkugler I wanted to do that, but I couldn't find a way to turn on dark mode. So, I ended up creating the app out of facebook.com instead.

maxoku commented 6 months ago

After last update it takes around 30-40% of my CPU when window is up, but 0% when minimized. Browser doesn't behave like this.