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

Signal Desktop GUI hogs CPU on macOS #3542

Closed
1 task done
f00b4r0 opened this issue Aug 27, 2019 · 150 comments
Closed
1 task done

Signal Desktop GUI hogs CPU on macOS #3542

f00b4r0 opened this issue Aug 27, 2019 · 150 comments

Comments

@f00b4r0
Copy link

f00b4r0 commented Aug 27, 2019

  • I have searched open and closed issues for duplicates

Bug Description

Signal Desktop GUI hogs CPU when updating (scrolling, new message, notification, etc)

Steps to Reproduce

  1. Install fresh Signal on previously clean system (Signal never installed before or ~/Library/Application Support/Signal deleted beforehand
  2. Start signal and link phone
  3. Start 'top -u' in a terminal window
  4. Go back to Signal, scroll list of contacts, scroll debug log, or receive an incoming message

Actual Result:

Watch in top "Signal Helper" eat 100% CPU and Window Server and kernel_task go as high or even higher. The machine suddenly feels very sluggish. If you have a HD video playing from e.g. YT it will skip frames or hang.

Expected Result:

Reasonable CPU usage for basic GUI operations.

Screenshots

While scrolling debug log (contact list edited out of the screencap)
Capture d’écran 2019-08-27 à 11 57 39

Platform Info

Signal Version: 1.26.2

Operating System: macOS 10.14.6 (18G87)

Linked Device Version: iOS 2.41.1.2

Link to Debug Log

https://debuglogs.org/13972c93626c56ed01526c541854dcdca5c55f6f383795ac795c4467eb505ea6

@f00b4r0 f00b4r0 changed the title Signal GUI hogs CPU on MacOS 10.14.6 Signal Desktop GUI hogs CPU on MacOS 10.14.6 Aug 27, 2019
@scottnonnenberg-signal
Copy link
Contributor

What happens after that first couple minutes of runtime? It's reasonable to expect an application to do some work up front to make things faster going forward, or when processing a lot of data, but it would be an issue if it were a long-term trend. Speaking of processing a large amount of data, do you have a lot of contacts? The more contacts you have, the more data Desktop needs to decrypt right after you link.

@f00b4r0
Copy link
Author

f00b4r0 commented Sep 4, 2019

I'm sorry if I gave you the impression this is a "startup" kind of bug, it's absolutely not.

I guess you assume that from the screenshot: for the purposes of the screenshot I had just restarted Signal, but it happens regardless of runtime.

And it's not background activity, the correlation with GUI changes is clear: it notably happens on new received messages. Indeed, the first time I experienced that bug I was watching a HD YT video when I received a message: I heard the signal notification sound (can't remember if that was on my phone or on the Mac so don't assume the notification sound went immediately through on the latter) and then almost everything came to a complete halt on my machine, before resuming moments later after the notification and new message had been displayed. As for contacts, I have exactly 13 at this time.

@scottnonnenberg-signal
Copy link
Contributor

At this point we're going to need a whole lot of information about your computer. Machine specs (hardware visual acceleration details too), its performance and CPU usage in Google Chrome, etc. We can't repro what you describe locally, so we're relying completely on data you provide.

@f00b4r0
Copy link
Author

f00b4r0 commented Sep 6, 2019

Specs of the machine: https://everymac.com/systems/apple/macbook_pro/specs/macbook-pro-core-i7-2.5-15-dual-graphics-mid-2015-retina-display-specs.html
Point of interest: it has a retina display.

As for Google Chrome, being privacy-conscious I never use it. I'm ok to perform tests but could you elaborate on what I need to test for please?

FWIW 1.27.1 still exposes the problem. I've also updated to 10.14.6 18G95

@scottnonnenberg-signal
Copy link
Contributor

@f00b4r0 Hit any somewhat complicated site in Chrome, and look at the CPU usage.

You can also tell us about your usage of Signal Desktop. Do you have a lot of disappearing messages visible at any given time in the app? What about if you open a conversation with no messages in it, does that change the CPU usage? We're looking for anything that might contribute.

@f00b4r0
Copy link
Author

f00b4r0 commented Sep 6, 2019

So I checked out apple.com and theregister.co.uk frontpages in a freshly started Chrome (run from disk image) vs Safari. Chrome's CPU is very significantly higher than that of Safari, typically 3-4x higher and the websites feel a lot less responsive. CPU usage was not as bad as what I saw scrolling the debug log in Signal.

Then it dawned on me to browse and rapidly scroll my uploaded debug log from Chrome and bam, exactly the same madness: ~200% CPU load in top... By comparison, browsing/scrolling (same pace) the same webpage from Safari uses 30-35% CPU total (Safari ~10% + WindowServer ~25% )

As for my usage of Signal, it's extremely sparse. I occasionally exchange plain text with one contact at a time and no special features (disappearing message), save for the occasional smiley...

@scottnonnenberg-signal
Copy link
Contributor

The only thing I can think of is that your graphics hardware acceleration is having major problems.

Try launching Signal Desktop without hardware acceleration. Open up Terminal, then run this:

/Applications/Signal.app/Contents/MacOS/Signal --disable-gpu --force-cpu-draw

@f00b4r0
Copy link
Author

f00b4r0 commented Sep 6, 2019

If I do that and rapidly scroll the debug log I see one Signal Helper thread at ~75%, another at ~15% and WindowServer at ~15%, which is clearly better than the previous case.
However I'm not experiencing this kind of problem with any other piece of software I use on this machine (besides Chrome now that I just tested it), so I'm not sure how "[my] graphics hardware acceleration is having major problem" describes the issue here?

@lnicola
Copy link

lnicola commented Oct 29, 2019

@f00b4r0 have you noticed any connection between the hangs and the contact typing indicator?

@f00b4r0
Copy link
Author

f00b4r0 commented Nov 3, 2019

@lnicola Not that I recall. I eventually stopped using Signal Desktop.

@ggould256
Copy link

I am seeing this as well -- on my beefier machine it is typically two SignalHelper processes each using 20% of CPU plus WindowServer at 30%; all go away when I stop signal. I can try to get reproduction scenarios or logs if someone tells me what is needed.

For me the issue typically happens just before the UI receiving a message in the few minutes after waking from sleep -- in fact I know a message will arrive shortly when I hear my laptop fans spin up.

Here's a typical snapshot of my top three processes during the CPU load incident, via top -u:
Screen Shot 2020-01-25 at 8 45 22 AM

There's nothing obviously weird in the debug log. I've uploaded it anyway in case it helps. https://debuglogs.org/84dd96ce52bcd1b47429ea6da928d3273bdcfd5140830240e204bd1642fd65dd

Hope this helps! Signal being heavier than my web browser is just strange.

@f00b4r0
Copy link
Author

f00b4r0 commented Jun 1, 2020

Out of curiosity I tried a recent (v1.34.1) Signal Desktop client on my Mac (same model as before: I like it ;).

As soon as a contact starts typing and the waving three dots appear in the chat window, the machine is completely stuck. Absolutely no other window will update (rainbow disc everywhere), it's totally insane. sigh

@scottnonnenberg-signal
Copy link
Contributor

@f00b4r0 One thing that Mac users can do to help us out is an Activity Monitor 'sample.' Double-click the process in Activity monitor, and you should see a 'Sample' button in the bottom-left. This is especially useful if it's while that 'rainbow disc' is showing.

@f00b4r0
Copy link
Author

f00b4r0 commented Jun 27, 2020

I tried sampling during "typing indicator". Sampling while rainbow disc seems impossible as nothing is responsive during that time and the Activity Monitor sampling period is very short (3s).

As far as I can tell the GPU helper is the one hogging the CPU.

HTH

Échantillon de Signal.txt
Échantillon de Signal Helper (GPU).txt
Échantillon de Signal Helper (Renderer).txt

@scottnonnenberg-signal
Copy link
Contributor

@f00b4r0 Thanks for taking those samples. However, they aren't very useful without a pretty detailed account of what was happening in the app at that time. You mention a typing indicator - were you in a 1:1 chat with someone, with the typing indicator showing?

@f00b4r0
Copy link
Author

f00b4r0 commented Jun 29, 2020

@scottnonnenberg-signal well, I merely did what you asked: you asked for samples, I provided. You didn't ask for context 😛
FWIW I didn't find a detailed "how to report a bug" entry on signal.org's FAQ (the closest thing was "how to share a debug log", which isn't helpful here), and I can't guess what you need: please be specific, and I'll do my best.

Re your question: Signal app started, 1:1 chat, typing indicator (from remote party nice enough to bear with my testing and provide long type sequences) showing, yes.
HTH

@scottnonnenberg-signal
Copy link
Contributor

@f00b4r0 Thanks. What can you say about your computer? Model? Year?

@f00b4r0
Copy link
Author

f00b4r0 commented Jun 30, 2020

See #3542 (comment)

@lnicola
Copy link

lnicola commented Jun 30, 2020

You mention a typing indicator - were you in a 1:1 chat with someone, with the typing indicator showing?

I noticed the same thing (Skylake iGPU laptop, Linux). When the typing animation is running, the text I'm typing does not (did not?) appear. That's with 1:1 chats. The renderer process is using a lot of CPU while the animation is showing.

@gordonklaus
Copy link

You mention a typing indicator - were you in a 1:1 chat with someone, with the typing indicator showing?

I noticed the same thing (Skylake iGPU laptop, Linux). When the typing animation is running, the text I'm typing does not (did not?) appear. That's with 1:1 chats. The renderer process is using a lot of CPU while the animation is showing.

Same here. I see elevated CPU usage in a 1:1 chat when my peer is typing (typing indicator showing). On a MacBook Pro, OS X 10.15.6.

@jlfranklin
Copy link

I see 100% CPU on Mac OS X 10.14.6 (Mac Pro Late 2013, 64GB RAM) when Signal (upgrading to 1.36.2 and earlier) is asking for admin creds to install a new helper app. If that happens when I'm AFK, I come back to noticeably louder fans from the Mac Pro.

The rest of the time, it's generally idle -- ~0.3-0.5% CPU (always, polling?) for the renderer, 0.0-1.0% for the main process.

Clicking on a different contact or group on the left to switch conversations will spike the Signal renderer to ~50% CPU for a few seconds.

Haven't checked while having a conversation with someone.

@scottnonnenberg-signal
Copy link
Contributor

@jlfranklin Why would that helper app pop up while you're AFK? It should only pop up after you've chosen to restart signal.

@ggould256
Copy link

Not sure if this is the same issue, but here's a sample just before Signal Helper (GPU) forced my (otherwise totally idle) laptop into thermal throttling:
Sample of Signal Helper (GPU).txt

While this was happening -- and it stopped as soon as I killed Signal Helper -- the Window Server process was also running at a surprisingly high CPU. So I snagged a sample of it as well if it helps.
Sample of WindowServer.txt

Again, not sure if this is the same issue or not.
Given how idle-ish those samples look, I wonder if the issue is signal thrashing the GPU (reloading shaders, eg?) without necessarily doing anything suspicious in the CPU stack trace side of things.

@jvimal
Copy link

jvimal commented Feb 7, 2022

The private relay is a clue. It's likely using the same technology (transparent proxy) underneath that's causing this issue.

@EvanHahn-Signal did you get a chance to look at libuv/libuv#482 (comment)? There could be an easy fix that could provide relief on MacOS for sure if Signal upgrades libuv to the version that has the fix referenced from the discussion above...

@onyx4
Copy link

onyx4 commented Feb 7, 2022 via email

@indutny-signal
Copy link
Contributor

I opened a PR to electron to backport the libuv patches: electron/electron#32856 . Thanks for letting us know about the fix!

@luv2dnce33
Copy link

rebuilt my mac os machine multiple times and it suffers from signal helper and other signal sub processes sucking down CPU at 5%+ at idle. ridiculous.

@axfelix
Copy link

axfelix commented Apr 8, 2022

FYI -- I've noticed this creeping back upwards again after it was fixed at one point, but it's not as bad as it was in the past, nor is it as bad as Discord currently, so I think we're just stuck with some upstream Electron macOS renderer optimization issues, unfortunately nothing exceptional at this point.

@luv2dnce33
Copy link

luv2dnce33 commented Apr 8, 2022

I wouldn't say even remotely that it is tolerable. A chat app constantly draining 10% CPU is unreasonable at best. Perhaps justifiable if it is rendering video playback or running heavy search indexing. Otherwise, there is no reason why text display should render this many CPU cycles. AT IDLE no less. 5% is plenty to turn my 2019 8-core i9 into a rocket ship. And I say 5% as a courtesy. The average is closer to 10%.

image

This app has been a nightmare and miserable to use ever since being forced to abandon Keybase -- a real OTR E2EE messenger.

@VadimMuhtarov
Copy link

I have the same problem. Idle wake-ups with closed window is almost equal to Skype wake-ups during video call.
Screenshot

@luv2dnce33
Copy link

@VadimMuhtarov don't bother. these guys are low class and couldn't be bothered, clearly. its not like this issue hasn't been going on for years already. Signal devs are not optimizing for usability or function; they are optimizing for a sexy tech stack and lack the care and interest to even understand what they're doing, let alone improve it.

@ashemedai
Copy link

Just to provide some additional data points, on my Macbook (early 2015; Monterey 12.4) I have Signal constantly running in the background, this is my idle experience:

image

I am directly connected to my WiFi, no VPNs or anything of that nature. While using this I also have Signal open on my Windows desktop as well as my Android mobile phone.

So hopefully this shows that the problem is not as easy to pinpoint as some people in this issue are trying to make it sound like.

@luv2dnce33
Copy link

They pushed a patch in the most recent update after 4 years that addressed it ... for now. I'm sure it will resurface as it always does.

#5946

@luv2dnce33
Copy link

aaaaand back to 15% cpu at idle. what a circus this dev team is.

@scottnonnenberg-signal
Copy link
Contributor

@luv2dnce33 Please consider providing a debug log and profile (from the Performance tab in the dev tools).

@luv2dnce33
Copy link

fix this disgusting garbage app JFC

@luv2dnce33
Copy link

still ticking 5%+ at idle. good job guys.

@luv2dnce33
Copy link

how many version releases and major releases will we go through before this is fixed? 🤡

@hraban
Copy link

hraban commented Jul 25, 2023

I'm on a Macbook Pro 2023, M2, and the Renderer helper process idles at about 40% when a chat with messages is open. When I have no chat selected (e.g. fresh startup), or a chat without any messages in it, it's almost 0% CPU. As soon as I open any chat with messages: bam, 20-40%.

What kind of debug logs do you need? There's a bit of a backlog on this issue so it's hard to find the latest instructions on what's helpful here :P. The "sample" file from Activity Monitor? And what would you want me to do while sampling--switch between with/without messages, or would you rather have two separate samples: one with, one without? How long would the sampling be , a few seconds?

No VPN, Darwin 22.5.0, macOS 13.4.1, Mac14,6, Apple M2 Max, Signal 6.26.0

@ashmanskas
Copy link

ashmanskas commented Jul 27, 2023

Same symptom as @hraban. If I open Signal, negligible CPU usage. I then open either "note to self" or the chat with my wife (but no active typing), Signal Helper uses 40% CPU (on an old 2015 MacBook Air). I then switched to an archived chat with no history and CPU usage is back to zero. Is there some sort of --verbose flag that can capture activity for diagnosis? I never noticed this behavior before the past few days.

[update 2023-08-03 ]Using 6.28.0-beta.2 for about a week now, the CPU usage issue has not yet returned. Many thanks for your work!

@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

@ashmanskas
Copy link

ashmanskas commented Jul 28, 2023

@scottnonnenberg-signal I'm running the beta version and so far I don't see the CPU usage issue. I'll follow up after several days.

[update 2023-08-03 ]Using 6.28.0-beta.2 for about a week now, the CPU usage issue has not yet returned. Many thanks for your work!

@hraban
Copy link

hraban commented Jul 28, 2023

Beta version fixed it for me

@jamiebuilds-signal
Copy link
Member

Cool, glad it's fixed, following it up with another PR to optimize timeline scrolling more generally, but I'll treat that as a separate issue and close this.

@spawnflagger
Copy link

I was also seeing this issue (high CPU when viewing a conversation, but no rainbow-ball/lock/crash) using Signal 6.26.0 on macOS 11.7.7, running on 2020 Intel MacBook Air (retina). I tried the beta, and it doesn't show this bug, however the beta doesn't have any history, and I suspect the original rendering bug was triggered by longer conversations... my main purpose of using the desktop app is to keep the history, it's much easier to search than on the phone, and I have preserved data between 2 phone upgrades and 1 laptop upgrade. If there's a way to import history file(s) into the beta, I can test that theory and report back. Otherwise I will just cross my fingers and hope the fix makes it from beta->production.

@hraban
Copy link

hraban commented Jul 30, 2023

@spawnflagger if it's any consolation, I have a very short expiry date for all my chats and the cpu hogging seems unrelated to length of history. The behavior seems more if len(messages) > 0 then hogcpu().

@scottnonnenberg-signal
Copy link
Contributor

@spawnflagger @hraban Have you seen any CPU usage improvements on Desktop 6.27.0?

@spawnflagger
Copy link

@spawnflagger @hraban Have you seen any CPU usage improvements on Desktop 6.27.0?

on 6.27.1 (auto update), the behavior is much improved. Signal Helper (Renderer) process jumps up (50-70% CPU) while scrolling, but settles back down to <1% CPU after a few seconds. Switching between conversations (but not scrolling), it jumps to 20-30% CPU for 1-2 seconds, then back low. Signal Helper (GPU) also goes back to 0.0% while not scrolling.

@hraban
Copy link

hraban commented Aug 4, 2023

@spawnflagger @hraban Have you seen any CPU usage improvements on Desktop 6.27.0?

Nope seems fine now. Thanks.

@luv2dnce33
Copy link

imagine complaining for 4 fucking years for someone to fix what was probably 6 lines of code. fucking dolts.

@hraban
Copy link

hraban commented Sep 7, 2023

Can somebody ban this person from the Signal organization's projects?

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

No branches or pull requests