signalapp / Signal-Desktop

A private messenger for Windows, macOS, and Linux.
https://signal.org/download
GNU Affero General Public License v3.0
14.52k stars 2.63k forks source link

Background CPU usage increases over time #5127

Open AlbinoGeek opened 3 years ago

AlbinoGeek commented 3 years ago

Bug Description

After resuming the system from standby, or simply leave the signal-desktop application running for many hours, the application continues to churn through computer resources, steadily using more and more CPU over time.

Steps to Reproduce

  1. Open signal-desktop
  2. Do literally nothing for 6-12 hours.

Actual Result:

Come back to a system load above 5 and entire pinned cores by signal-desktop ... This happens regardless of the number of contacts, conversations or messages in the account. This happens regardless of using physical or virtual hardware. This even happens in an AWS EC2 instance.

I even tried virtual linked devices to remove my phone(s) as variable(s).

Expected Result:

NEARLY ZERO background CPU usage, especially in an empty account, with no messages being received or expiring.

Screenshots

[ I will post more screenshots after leaving it to bloat itself for another 6 hours... ]

Platform Info

Combination 1 (on Physical Hardware)

Signal Version: v1.40.1

Operating System: Fedora Workstation 33 Kernel: 5.10.19-200.fc33.x86_64

Linked Device Version: Android 11 Kernel: 4.19.113-20937596

Combination 2 (KVM Virtual Machine)

Signal Version: v1.40.1

Operating System: Fedora Workstation 33 Kernel: 5.10.19-200.fc33.x86_64

Linked Device Version: Android 11 Kernel: 4.19.113-20937596

Combination 3 (AWS EC2 t2.micro)

Signal Version: v1.40.1

Operating System: Debian 10.8 Kernel: 4.19.0-14.ec2.x86_64

Linked Device Version: Android 11 Kernel: 4.19.113-20937596

Combination 4 (AWS EC2 t2.micro) + Virtual Android

Signal Version: v1.40.1

Operating System: Debian 10.8 Kernel: 4.19.0-14.ec2.x86_64

Linked Device Version: Android 10 Kernel: 4.19.71

Link to Debug Log

Since there wasn't any information on whether a Debug Log contains any sensitive information... No.

It's reproducible with new accounts, and on both physical and virtual machines (including on a t2.micro instance on AWS with a basic X desktop installed), so has absolutely nothing to do with my account or computer hardware.

hiqua commented 3 years ago

So you're saying that's a bug that should be reproducible on all platforms with all accounts?

How do you measure the system load, htop? The CPU% column?

I often leave it open for a full day but I haven't noticed this yet.

If you create a new AWS instance with a new account there can't be any sensitive information in the debug log by definition.

AlbinoGeek commented 3 years ago

How do you measure the system load, htop? The CPU% column?

(I did mean *nix load average literally, as well as CPU% shown in htop, see below:)

In this case, system load was seen as steadily increasing while being watched with: dstat -l --cpu-adv -nd --mem-adv

Which I then confirmed was attributed to signal-desktop in htop (F4 for incremental process search), the CPU% column.

The first few times this happened, signal-desktop was being killed by my malware detection scripts, which kill runaway processes (those with seemingly unrestricted CPU usage over an unrealistic timespan)- so at first, I couldn't even monitor this properly. I've excluded signal-desktop from this check for the sake of this issue.


So you're saying that's a bug that should be reproducible on all platforms with all accounts?

I often leave it open for a full day but I haven't noticed this yet.

It appears to be reproducible in combinations of Android 10/11 and Linux 4.19/5.10, yes. I have not tested Windows or Mac OS X, let alone an iPhone (I don't have one atm to test with.)


If you create a new AWS instance with a new account there can't be any sensitive information in the debug log by definition.

Good point! I'll repeat this test on AWS with a new account and attach that debug log (could take up to 48 hours to reproduce. This is not a consistent increase of CPU, it appears to be a "jagged increase" if graphed.)

This makes me wonder if there are background tasks or CRON-alike (scheduled / time-based) cleanup or database management, etc that is simply getting backed up, or not cleanly exiting.


It's also worth noting that if signal-desktop is closed when it is in this resource-hogging state, it gets left a permanent zombie and is not cleaned up by the desktop. (It's PPID matches gnome-session, which isn't restarted even when you do Alt+F2``r, so I cannot cause the process to be handed back to init for cleanup without restarting my whole system.

image

I'll also note that signal-desktop are my only zombies, and the only reason I ever have to restart my Desktop [I use live kernel merge updates, which have worked well for years.]

[damon@doom ~]$ ps aufx | grep Z
damon      10344  0.0  0.0      0     0 ?        Z    Mar13   4:43  |   \_ [signal-desktop] <defunct>
damon    2054114  0.0  0.0      0     0 ?        Z    Mar21   3:38  |   \_ [signal-desktop] <defunct>
hiqua commented 3 years ago

Honestly your config seems a bit too exotic for me not to suspect it being the root cause. Is there any chance you can reproduce that issue with a docker container? Or anything else that's easily reproducible? That'd be easier to share, I don't really want to set up signal-desktop on a AWS instance for a bug only you seem to be having.

AlbinoGeek commented 3 years ago

I showed the bug as happening on my desktop in case 1, and a simple VirtualBox VM in case 2...

On Sat., Mar. 27, 2021, 11:08 a.m. Quentin Hibon, @.***> wrote:

Honestly your config seems a bit too exotic for me not to suspect it being the root cause. Is there any chance you can reproduce that issue with a docker container? Or anything else that's easily reproducible? That'd be easier to share, I don't really want to set up signal-desktop on a AWS instance for a bug only you seem to be having.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Desktop/issues/5127#issuecomment-808772904, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOSNPOZ2NPGIWZ5ZJDYUETTFYNJ3ANCNFSM4Z4OS74Q .

ardarandir commented 3 years ago

Is this issue still persisting under new Signal 5.0.0? Otherwise this bug could be closed.

AlbinoGeek commented 3 years ago

Hard to know, version 5 has not reached Fedora 33 yet (snap still shows the version I opened this issue with.)

Will try a git version manually later and let you know.

On Sun., Apr. 18, 2021, 4:35 a.m. Jomi Wagner, @.***> wrote:

Is this issue still persisting under new Signal 5.0.0? Otherwise this bug could be closed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Desktop/issues/5127#issuecomment-821977404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOSNPNPOALHBZPPTST7CLLTJK7WPANCNFSM4Z4OS74Q .

AlbinoGeek commented 3 years ago

Is this issue still persisting under new Signal 5.0.0? Otherwise this bug could be closed.

Still occurs in 5.3.0 now that this version has arrived in the now stable Fedora 34.

wwkeyboard commented 3 years ago

On OSX 11.4 I also see Signal Helper (Renderer).app idle at ~3-4% cpu, higher than any other apps. This is using v5.9.0, both with the app running for several days and just after restarting it.

litinoveweedle commented 3 years ago

Pop OS 21.04, with official deb package v5.9.0, I see on my i7-5600U constant 10-13% CPU usage in top

ngrigoriev commented 2 years ago

I also observe strange behavior. I use Signal quite infrequently, so it is idle 99% of the time. Yet, when the system is idle, Signal is usually at the top of the top ;) This application performs surprising amount of activity when doing nothing and now even being displayed - it is on the desktop that is not visible at this moment. The messaging (!) application runs 8 processes, one of them has something with GPU (for God's sake, why?). I am not familiar with the internals of the app but it seems there is Chromium there.

AlbinoGeek commented 2 years ago

Yeah, I got tired of signal doing something questionable with my system resources, I only run it in a very small sandbox now so that it's not crypto mining on my computer, or whatever the hell it decides to do with my 28 cores all day long at 100%......

On Wed., Dec. 8, 2021, 5:22 p.m. Nikolai Grigoriev, < @.***> wrote:

I also observe strange behavior. I use Signal quite infrequently, so it is idle 99% of the time. Yet, when the system is idle, Signal is usually at the top of the top ;) This application performs surprising amount of activity when doing nothing and now even being displayed - it is on the desktop that is not visible at this moment. The messaging (!) application runs 8 processes, one of them has something with GPU (for God's sake, why?). I am not familiar with the internals of the app but it seems there is Chromium there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Desktop/issues/5127#issuecomment-989381225, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOSNPLG2CS2NN2ROHDXDFDUQAAF3ANCNFSM4Z4OS74Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

rpc31 commented 2 years ago

Same issue here with Macs Monterey 12.0.1 and Signal 5.25.1. At some point, I'll notice that my fans are getting pretty loud while doing nothing: opening the activity Monitor will every-time reveal Signal using 99% of CPU. I have to quiet the app then restart it. I'm also using what's app and Telegram in the background and Signal is the only one with such behavior.

EvanHahn-Signal commented 2 years ago

Sorry folks are running into this. We've been trying hard to get to the bottom of these issues. If you have reliable reproduction steps, deeper investigation, or even theories, we'd love to hear them!

alien2003 commented 2 years ago

Sorry folks are running into this. We've been trying hard to get to the bottom of these issues. If you have reliable reproduction steps, deeper investigation, or even theories, we'd love to hear them!

Reproduced on Arch, both in Beta and Release versions. I hope that it will be resolved soon, because it's critical. Maybe Ctrl+Shift+F12 chromium debugging would help? I can't open it in Signal for some reason

chronos000 commented 2 years ago

Check out possible solution on this comment: https://github.com/signalapp/Signal-Desktop/issues/4459#issuecomment-1003053281

TL;DR: disable notifications in Signal's settings

brzd commented 2 years ago

Sorry folks are running into this. We've been trying hard to get to the bottom of these issues. If you have reliable reproduction steps, deeper investigation, or even theories, we'd love to hear them!

Commented on #4459:

Has anyone tried tracing gif and other media that may cause load issues if ran in the background for long period of time in several message streams? Also just a hunch if this could be related to disk usage and files as attachments to signal?

necropola commented 2 years ago

After switching off notifications signal-desktop on windows (10) seems to stop eating precious CPU cycles, but when I minimize it to the system tray the "polling" starts again. I'm seeing roughly 10% on average.

This should be very easy to reproduce. No such issue on Linux by the way.

This is a Performance Monitor Graph from signal-desktop (5.47.0) being minimized to the system tray. The same graph is pretty much a flat line when the application window is open and showing my Note to Self conversation. Signal-Desktop - WIndows 10 -Performance Monitor

Don't know, if it is relevant, but my Windows 10 is a VM with GPU passsthrough running on Linux with QEMU/KVM. More often than not my idle Windows Desktop is the top CPU hog according to conky on my Linux host (that's how I noticed). Signal-desktop is one of the reasons why. The other two are discord (also electron based) and chrome which also behaves rather badly when idle.

AlbinoGeek commented 2 years ago

Funny, for me this is a thing that happens on Linux, but didn't happen on Windows 10.

But yes, if you use signal more than once every few days, say you actually treat this as your primary messaging app, so you have tens of thousands of messages in your database, this is 100% reproducible.

The best part? Even if I uninstall the client, and then reinstall it, which means I have none of the messages and a clean database, the polling still happens if I just let the program run.

It's gotten to the point where I've made a script that kills signal if it's been idle for an hour, and automatically restarts it. I'm treating it just like a Java server at this point.

On Thu., Jun. 23, 2022, 11:12 p.m. Necropola, @.***> wrote:

After switching off notifications signal-desktop on windows (10) seems to stop eating precious CPU cycles, but when I minimize it to the system tray the "polling" starts again. I'm seeing roughly 10-20% on average. This should be very easy to reproduce. No such issue on Linux by the way.

— Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Desktop/issues/5127#issuecomment-1165235129, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOSNPM7JHPMF3FDSEJVPDDVQVGURANCNFSM4Z4OS74Q . You are receiving this because you authored the thread.Message ID: @.***>

indutny-signal commented 2 years ago

@AlbinoGeek sorry you keep running into it. On Linux do you think you could try running with --disable-gpu to see if there is any improvement?