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

Permanent CPU load when nothing is happening #4459

Closed
1 task done
RalfJung opened this issue Aug 24, 2020 · 82 comments
Closed
1 task done

Permanent CPU load when nothing is happening #4459

RalfJung opened this issue Aug 24, 2020 · 82 comments

Comments

@RalfJung
Copy link

  • I have searched open and closed issues for duplicates

Bug Description

After opening Signal-Desktop, even when nothing is happening in the open conversation (no animation or disappearing message or anything like that), there is a 50% load (meaning 50% of one CPU core) permanently. Only minimizing the window makes that load disappear.

This issue was reported before (#3904), but that one was closed with a fix claimed for v1.33. However, that fix does not seem to help here (and others are reporting the same in that issue).

Steps to Reproduce

  1. Open Signal
  2. Select a Conversation
  3. Alt-tab to a process manager

Actual Result:

The process manager (htop in my case) show 50% CPU load (this is relative to 1 core).

Expected Result:

There should not be noticeable load when nothing is happening.

Platform Info

Signal Version:

Operating System: 1.34.5

Linked Device Version: 4.64.5

Link to Debug Log

https://debuglogs.org/436ed8e435336c02cf3c19ab6bd5b7fdbd3bfb3f5738de984fe5ca568b79480b

@scottnonnenberg-signal
Copy link
Contributor

The scenario you mention - how many messages from the server were processed? And then, what happens to CPU usage after a couple minutes?

I would expect relatively high CPU usage after startup, as things are being loaded and run for the first time, but then things would settle down.

@RalfJung
Copy link
Author

I started measuring only after things settled down. So there are no messages received at all, as far as I can see.

Even now, 12h later (I had Signal minimized all the time), when I un-minimize it, I get 50% load.

@scottnonnenberg-signal
Copy link
Contributor

@RalfJung Can you talk a little more about your hardware, the details of how CPU usage changes?

Do you use disappearing messages heavily? Are a lot of messages showing when CPU usage is high? Or does it even happen in an empty conversation?

Then, what kind of CPU usage do you see in Chromium? Does it also use a lot of CPU to render a web page?

@RalfJung
Copy link
Author

RalfJung commented Aug 24, 2020

Can you talk a little more about your hardware, the details of how CPU usage changes?

Not sure what to say here... cpuinfo says "Intel(R) Xeon(R) CPU E3-1505M v5 @ 2.80GHz", I have 4 physical cores and hyperthreading (so 8 logical cores).

CPU usage of the signal process changes from basically nothing to 40-50% when I un-minimize Signal.

Do you use disappearing messages heavily? Are a lot of messages showing when CPU usage is high? Or does it even happen in an empty conversation?

I don't use disappearing messages at all. The number of messages that show are what fits on my screen (1920x1200px)... around 10 I'd say.

I tried various different conversations, and that seems to have no effect. But what I just noticed is that when I scroll down in the conversations list on the left (but leave the active conversation on the right the same), the load goes away. So it seems to have something to do with that list.

Then, what kind of CPU usage do you see in Chromium? Does it also use a lot of CPU to render a web page?

I don't use Chromium. But I use vscode, another electron app, and while it sometimes has background load, it is not nearly as high as Signal's. Also the fact that scrolling down makes the load go away IMO demonstrates that this is a Signal issue.

@scottnonnenberg-signal
Copy link
Contributor

The more you can narrow down exactly what UI elements are causing this, the more it would help us. I see that you're not using the beta - you could set up a second instance on that same machine via the beta, and do some experiments. It would really help. Thanks!

@jeffdgr8
Copy link

I've been seeing this as well. After the Signal app has been open for a while, my computer will often become bogged down with low CPU resources and checking the process manager Signal is taking 100% CPU. I'm running 1.34.5 in Linux on Chrome OS. I have a Core i7 Y-series CPU, plenty powerful for bursts of short loads, but really can't handle sustained heavy CPU loads well.

I don't use disappearing messages at all either. My 12" screen can show 5-10 messages in a conversation at once. Seems like most of the time I've seen this happen was after I'd had the app open and received a bunch of messages, mostly in one single conversation, during the day.

@RalfJung
Copy link
Author

I see it happen even when I restart Signal -- i.e., when there are no new messages and Signal runs in a fresh instance.

@ProactiveServices
Copy link

I intermittently see the same behaviour here - 12-15% CPU - with a one-to-one conversation open, with a conversation that has no history, a relatively quiet group of three people, with note to self and with the chat window closed via Ctrl-C. None of the conversations have any recent reactions, animated media or stickers.

Kubuntu 20.04 LTS using Signal 1.36.1-beta.2, 2.6GHz Intel Core i5.

@scottnonnenberg-signal
Copy link
Contributor

@ProactiveServices if we could get a look at your log, that would help us determine if Signal is doing any work in the background during that time.

@ProactiveServices
Copy link

I've also captured a 60s performance profile from the devtools, if that'll be helpful - if so do I need to anonymise any of the data present in it?

@scottnonnenberg-signal
Copy link
Contributor

@ProactiveServices My understanding is that the only identifiable information in those kinds of performance traces are the screenshots. They can be really useful to help track things down, of course. But then again we're not interested in relating your log to user action, but inaction. I don't think we need them. Please feel free to send your log to one of us directly, or to support. Thanks!

@kentchristopher
Copy link

I'm getting a constant 5% CPU usage in v1.37.2 on Kubuntu which I found is due to a link preview in one recent message. Clicking on another contact with no messages made it go away but that's temporary. Deleting the message with the link stopped it.

There should really be an option to turn off previews.

@scottnonnenberg-signal
Copy link
Contributor

@kentchristopher Is there anything else you can tell us about the link preview contents? Was there perhaps an animated gif included? Was it a disappearing message? Anything else out of the ordinary?

@kentchristopher
Copy link

@scottnonnenberg-signal, no animated gif, not a disappearing message - just a URL, this one in case you want to try to replicate.

@rebastion
Copy link

rebastion commented Nov 5, 2020

One reason I had erroneously switched to the snap version (I just switched back knowing it's not officially supported) was the high CPU use. So now I am back on the official Signal, and lo and behold. Not doing anything it is at 17% CPU, fans blowing for no reason. And that is several minutes after launch of the app - and there is nothing to process because it doesn't carry over old conversations ("For your security, conversation history isn't transferred to new linked devices.")..... it even keeps on doing that after I quit signal
Screenshot from 2020-11-05 19-21-43

@ProactiveServices
Copy link

Debug log from Signal 1.39.4-beta 1, Kubuntu 20.04.1. The only activity, since it was idle, has been a small number of messages in a V2 group of three members. The problem is recurring multiple times a day, only way to solve it seems to be to frequently close and re-open.

@kaimast
Copy link

kaimast commented Feb 2, 2021

I'm getting a constant 5% CPU usage in v1.37.2 on Kubuntu which I found is due to a link preview in one recent message. Clicking on another contact with no messages made it go away but that's temporary. Deleting the message with the link stopped it.

There should really be an option to turn off previews.

I seem to always have 5% CPU usage. Even when the application is minimized. Maybe this is related to #4883?

Somewhat unrelated: I also have about 600mb of memory usage, which seems extremely high considering I only have about 5 people I talk to on this app. Probably less than 500 messages in total.

@ProactiveServices
Copy link

@kaimast a debug log may be of assistance for diagnosis.

@ProactiveServices
Copy link

Debug log for the issue in 1.40.0-beta4

@kaimast
Copy link

kaimast commented Feb 7, 2021

Lets maybe just wait until Signal has been ported to Electron 11 (or 12). My hope is that some of the performance issues will be resolved then.

@kaimast
Copy link

kaimast commented Feb 24, 2021

Here's my log on 1.40 https://debuglogs.org/f6158dd159e830e0598e444c15ad6506df5364771c5e8c340f7f4f1631265f8b

It seems to be even worse now? About 10-12% CPU usage.

@diegoe
Copy link

diegoe commented Mar 9, 2021

FWIW I can only reproduce this when animated stickers are on screen. It's pretty clear when you display a sticker sheet and everything starts to slow down in Signal. Happens in Linux/macOS.

Using the web dev tools profiler clearly shows that the CPU keeps waking up to loop the animated GIF. If I hide or destroy the HTML element, the CPU goes idle, almost to 0%. Same happens if I switch to a plain text conversation, 20-30% CPU whenever GIFs are in screen. As others have suggested in other reports similar to this one, minimizing Signal drops the CPU use too.

I'd argue this is clearly a limitation of whatever the shipped Electron is doing. Maybe it's failing to detect GPU acceleration? Maybe it's built with less than ideal build options? I don't know, but I can confirm positively that GIFs trigger this issue. Similarly, on mobile, stickers algo make Signal crawl, specially if you have many packs installed.

My hot take is that GIFs shouldn't loop forever, but stop after X loops (which I have no clue how to measure on pure HTML/JS, but I guess there are npm modules for that?).

There are some hacky approaches like using canvas to create a "freeze frame": https://github.com/krasimir/gifffer/blob/master/lib/gifffer.js

I'd maybe articulate a possible solution as: "Make animated stickers loop only X times, and only play when visible" -- Would something along these lines be considered an acceptable change @scottnonnenberg-signal?

See similar: #3997

@ProactiveServices
Copy link

I almost never receive animated stickers or pictures and end up with 20-40% CPU usage after about 15 minutes of use, often with only a handful of text messages received.

@scottnonnenberg-signal
Copy link
Contributor

@diegoe Yeah, I think that'd be a fine PR. Do note that with our scroll virtualization, scrolling up and down, or even resizing the window horizontally, would likely reset the timer.

@stale
Copy link

stale bot commented Sep 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 24, 2021
@scottnonnenberg-signal
Copy link
Contributor

@joshgoebel Many thanks for that investigation - we'll get a fix out soon!

@lnicola
Copy link

lnicola commented Jul 9, 2022

Many thanks for that investigation - we'll get a fix out soon!

Does anyone know if this happened? I couldn't find it in the commit history.

EDIT: found it: 6b66dad.

@stale
Copy link

stale bot commented Oct 7, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 7, 2022
@ProactiveServices
Copy link

Still happening every day on 5.63.0-beta.1.

@stale stale bot removed the stale label Oct 7, 2022
@scottnonnenberg-signal
Copy link
Contributor

@ProactiveServices Can you be more specific about what is still happening?

@kaimast
Copy link

kaimast commented Oct 7, 2022

I get about 2.5% CPU usage even when no chat is selected (signal just shows contact list and "welcome to signal" screen)

@ProactiveServices
Copy link

@ProactiveServices Can you be more specific about what is still happening?

Still the same behaviour as per #4459 (comment)
I'll send over another debug log once it happens again this evening.

@stale
Copy link

stale bot commented Jan 6, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 6, 2023
@FiSHYsolutions
Copy link

FiSHYsolutions commented Jan 6, 2023

it's not that bad as in previous versions but it's still not good.

the app is running in the background, nothing happens. CPU usage and memory consumption is IMHO pretty high. the following screenshot shows not a peak but a constant load:

2023-01-06_18-57

bash$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy
bash$ snap info signal-desktop
name:      signal-desktop
summary:   Private messaging from your desktop.
publisher: Snapcrafters
store-url: https://snapcraft.io/signal-desktop
contact:   https://github.com/snapcrafters/signal-desktop/issues
license:   AGPL-3.0-only
description: |
  Private messaging from your desktop.
  
  To use the Signal desktop app, Signal must first be installed on your phone.
  
  **Are you having issues?**
  
  Let us know by creating a new issue here: https://github.com/snapcrafters/signal-desktop/issues
  
  **Authors**
  
  This snap is maintained by the Snapcrafters community, and is not necessarily endorsed or
  officially maintained by the upstream developers.
commands:
  - signal-desktop
snap-id:      r4LxMVp7zWramXsJQAKdamxy6TAWlaDD
tracking:     latest/stable
refresh-date: vor 21 Tagen, um 19:46 CET
channels:
  latest/stable:    6.0.1  2022-12-15 (420) 197MB -
  latest/candidate: 6.0.1  2022-12-17 (421) 197MB -
  latest/beta:      5.62.0 2022-11-24 (400) 192MB -
  latest/edge:      6.1.0  2022-12-18 (422) 190MB -
installed:          6.0.1             (420) 197MB -

btw:
it's worse if the app is running in the background (see screenshot above). if it's running in the foreground (still while nothing happens) cpu-usage is constant around 4%

2023-01-06_18-52

@stale stale bot removed the stale label Jan 6, 2023
@NibblyPig
Copy link

NibblyPig commented Feb 6, 2023

I'll put this comment here but maybe I should open a new issue.

Signal on windows uses a large amount of CPU/GPU when the window is visible. This CPU usage shows up under Desktop Window Manager, not the Signal exe itself. It also shows a spike in GPU usage.

I think this CPU usage is hard to detect via Task Manager. It may bump up Desktop Window Manager a little but it seems to really kill anything that is relying on max resources.

I was streaming God of War, which absolutely HAMMERS the cpu/gpu, given it nowhere reaches the framerate cap, whilst streaming it to Twitch, which also uses a lot of resources. The game was about 20fps lower than it should be (50fps when I expected 70fps) and the stream was choppy and unwatchable. I poked around for a while and the second I minimised the Signal window, it shot back up to 70fps and worked perfectly, despite the fps being capped at 80fps which it never reaches, so it's always using max system resources.

I use Signal to talk to literally two people, and send/receive maybe 30 messages per day total. I barely use it at all. But some part of it jams my system up.

@janvlug
Copy link

janvlug commented Feb 8, 2023

FWIW: I use Signal desktop, installed as flatpak, on a Librem5 phone and read "Ctrl+Shift+c will close the current conversation and reduce idle CPU usage significantly". Unfortunately, I cannot easily test if this is true, because there is no menu option to close the conversation, and I do not know how to press "Ctrl+Shift+c" on the keyboard of the Librem5.

However, I do know for sure that when I have Signal running, the battery of the phone is way faster empty than when not having Signal desktop running.

@janvlug
Copy link

janvlug commented Feb 10, 2023

See also issue #5444.

@stale
Copy link

stale bot commented May 11, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 11, 2023
@stale
Copy link

stale bot commented May 18, 2023

This issue has been closed due to inactivity.

@stale stale bot closed this as completed May 18, 2023
@CactiChameleon9
Copy link

Hey, this was marked as stale and then closed... but the issue is still present for me (fixed by closing conversation): 6.26.0, nixOS

@NibblyPig
Copy link

The issue has been around for a long time, I don't think it's unique to signal either, there seems to be an issue with windows when anything is animated on the screen within certain apps. I've seen it in Streamlabs OBS as well - as soon as you cover up the animated part, CPU usage drops massively. In streamlabs case, it was a tiny animated dot showing there was a new option in a menu. Even covering it with another window would fix it. I believe it's related to this.

@kaimast
Copy link

kaimast commented Jul 25, 2023

Hey, this was marked as stale and then closed... but the issue is still present for me (fixed by closing conversation): 6.26.0, nixOS

This was fixed recently for me (see issue #5444) but I see high CPU usage again starting a few days ago.

I observe the same behavior as you describe: when I close all conversations it is virtually 0 but with a conversation open it's about 50% constant usage.

@FiSHYsolutions
Copy link

for me the high cpu load is fixed and not an issue anymore in the "current" snap release.
running in foreground/background, single or group chat doesn't matter:

signal 2023-07-25_18-59

bash$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.2 LTS
Release:	22.04
Codename:	jammy
bash$ snap info signal-desktop
name:      signal-desktop
summary:   Speak Freely - Private Messenger
publisher: Snapcrafters✪
store-url: https://snapcraft.io/signal-desktop
contact:   https://github.com/snapcrafters/signal-desktop/issues
license:   AGPL-3.0-only
description: |
  **Note: To use the Signal desktop app, you must first install Signal on your phone.**
  
  Millions of people use Signal every day for free and instantaneous communication anywhere in the
  world. Send and receive high-fidelity messages, participate in HD voice/video calls, and explore a
  growing set of new features that help you stay connected. Signal's advanced privacy-preserving
  technology is always enabled, so you can focus on sharing the moments that matter with the people
  who matter to you.
  
  - Say anything - State-of-the-art end-to-end encryption (powered by the open source Signal
  Protocol™) keeps your conversations secure. Privacy isn't an optional mode; it's just the way that
  Signal works. Every message, every call, every time.
  - Go fast - Messages are delivered quickly and reliably, even on slow networks. Signal is
  optimized to operate in the most constrained environment possible.
  - Feel free - Signal is a completely independent 501c3 nonprofit. Development is supported by
  users like you. No advertisements. No trackers. No kidding.
  - Be yourself - You can use your existing phone number and address book to securely communicate
  with your friends.
  - Speak up - Whether they live across town or across the ocean, Signal's enhanced audio and video
  quality will make your friends and family feel closer.
  - Whisper in the shadows - Switch to the dark theme if you refuse to see the light.
  
  **Are you having issues?**
  
  Let us know by creating a new issue here: https://github.com/snapcrafters/signal-desktop/issues
  
  **Authors**
  
  This snap is maintained by the Snapcrafters community, and is not necessarily endorsed or
  officially maintained by the upstream developers.
commands:
  - signal-desktop
snap-id:      r4LxMVp7zWramXsJQAKdamxy6TAWlaDD
tracking:     latest/stable
refresh-date: vor 49 Tagen, um 18:33 CEST
channels:
  latest/stable:    6.20.0 2023-06-06 (505) 182MB -
  latest/candidate: 6.20.0 2023-06-01 (505) 182MB -
  latest/beta:      ↑                             
  latest/edge:      ↑                             
installed:          6.20.0            (505) 182MB -

@kaimast
Copy link

kaimast commented Jul 25, 2023

It looks like the snap version is quite outdated though. I am using the version on flathub, which is the most recent release (6.26).

@lnicola
Copy link

lnicola commented Jul 25, 2023

I can confirm, but this is a new issue. You should probably be watching #6544 instead. There's not much point in discussing it here.

@janvlug
Copy link

janvlug commented Jul 26, 2023

@FiSHYsolutions
Copy link

heavy cpu load after upgrade signal desktop (snap) from v6.20.0 to v6.26.0 in xubuntu 22.04.2 lts:

2023-07-28_20-36

this happens after starting and opening an existing a conversation. cpu usage is low direct after start showing the welcome message. i will revert to v6.20.0 now, because in v6.26.0 the tray icon is still missing.

@scottnonnenberg-signal
Copy link
Contributor

We've made a change to improve this in the latest beta - please consider installing it and seeing if it improves CPU usage for you: https://support.signal.org/hc/articles/360007318471-Signal-Beta

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

No branches or pull requests