signalapp / Signal-Desktop

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

App extremely slow to "Load messages" on macOS desktop #1990

Closed arikroc closed 5 years ago

arikroc commented 6 years ago

v1.1.0

macOS 10.13.2

Loading messages ... took >30 seconds, for about 600 messages

Yes I've searched. This is very similar https://github.com/WhisperSystems/Signal-Desktop/issues/1842 though mine is on mac not linux and mine is 1.1.0

Steps to repro

Get a few hundred messages

then launch signal latest on mac

actual result: it's very slow to start

expected it would launch instantly

unfortunately i'm not comfortable including anything from the logs. sorry i realize this is overly paranoid.

knokelmaat commented 6 years ago

I am again posting my desktop logs, just closing the app and reopening causes the reasonably long loading, on Arch Linux this time: https://debuglogs.org/6c95025177f03e1ee369877d61726260a3e3e7bd1b663f0d1edaae35edaa6aa6

GhostofGoes commented 6 years ago

Happened again. Got a log this time.

Windows 10 Pro version 1803, build 17134.112

Took about 2-3 minutes to load. Didn't monitor CPU usage unfortunately. CPU is i7-4790k.

scottnonnenberg-signal commented 6 years ago

@GhostofGoes Yep, huge numbers of contact syncs in that debug log. Something is modifying your contacts, causing Signal to detect that when it starts up and send all of that data to desktop. Quite frequently. I've already spoken with Android and they're not quite sure how to solve this problem because you do want Contact changes to be reflected in Desktop, right? :0) I'd encourage you to file a bug in the Signal Android repository and you can work with them on what the right solution is.

GhostofGoes commented 6 years ago

Is there a way to tune or temporarily disable the contact updating feature? My main desire is to be able to message people. My contacts rarely change (a few a week at most), so I would rather have a working system over out of date contacts.

On Thu, Jul 5, 2018, 10:30 Scott Nonnenberg notifications@github.com wrote:

@GhostofGoes https://github.com/GhostofGoes Yep, huge numbers of contact syncs in that debug log. Something is modifying your contacts, causing Signal to detect that when it starts up and send all of that data to desktop. Quite frequently. I've already spoken with Android and they're not quite sure how to solve this problem because you do want Contact changes to be reflected in Desktop, right? :0) I'd encourage you to file a bug in the Signal Android repository and you can work with them on what the right solution is.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Desktop/issues/1990#issuecomment-402780151, or mute the thread https://github.com/notifications/unsubscribe-auth/AGS0jOCp0E-4nC3Hr4LjpBfWOyMtO3fFks5uDj82gaJpZM4Rl_vX .

scottnonnenberg-signal commented 6 years ago

@GhostofGoes That's a good question for the Signal forums: https://whispersystems.discoursehosting.net/

But I do have one idea. You could try revoking Contacts permissions fpr Signal Android. Just remember that you'd need to turn it on again if you notice that things are out of date with your System contacts.

GhostofGoes commented 6 years ago

Thanks Scott. In the future, would the forums be a better place to report issues like this?

On Thu, Jul 5, 2018, 10:43 Scott Nonnenberg notifications@github.com wrote:

@GhostofGoes https://github.com/GhostofGoes That's a good question for the Signal forums: https://whispersystems.discoursehosting.net/

But I do have one idea. You could try revoking Contacts permissions fpr Signal Android. Just remember that you'd need to turn it on again if you notice that things are out of date with your System contacts.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/signalapp/Signal-Desktop/issues/1990#issuecomment-402783719, or mute the thread https://github.com/notifications/unsubscribe-auth/AGS0jF3AxtwSifq25nlUqVRGfF0c_jMJks5uDkI0gaJpZM4Rl_vX .

PaulColdren commented 6 years ago

Do others encountering this problem use DAVdroid on Android to sync their contacts with a (non-gmail) CardDAV server? I'm not sure how to extract debug info from DAVdroid, but I have a theory that something in DAVdroid is misbehaving and registering thousands of spurious of contact updates, which Signal for Android is diligently syncing to my Mac.

Yesterday, I started Signal on my Mac after it being off for just a single day, and it synced over 6,000 "messages" before it was usable. During that day, I sent/received maybe 20 legitimate messages through Signal for Android. I see lots of references to contact sync in signal logs, even though I know for sure that I did not make any manual contact updates on Android during this time.

jasonford1 commented 6 years ago

Just experienced the extremely slow "messages loading" screen. Felt like half an hour. MacBook Pro (15-inch, 2016)

Debug log here.

Bomper commented 6 years ago

Extremely slow on Ubuntu Linux too, v1.14.4. Loaded about 200 messages in 2 minutes.

scottnonnenberg-signal commented 6 years ago

@Bomper Your report isn't very useful without a log to help us determine the cause of the slow load. Do be aware that we download all attachments associated with those incoming messages, so one limiting factor is likely your download bandwidth.

asavageiv commented 6 years ago

Fairly slow to start on my MBP after an update. 10.13.6, 2.2 GHz Intel Core i7, 16 GB, SSD

https://debuglogs.org/b8ed66b7c3537a9169eb8b49c4c4529442d2afe248c89839ded1c7f472be9476

chucksense commented 6 years ago

Slow to start for me too. I do sling some images around and I have a fairly slow connection, so I'm guessing that's the culprit as well, however in case it's useful, my log for reference: https://debuglogs.org/e365d02a24a573ce6d7fd45a97cf009ae825a68519c37585e3fd2aaf057fd5df

@scottnonnenberg-signal

In the future we'll download attachments in the background, but for now any message with an attachment will make you wait that much longer on the loading screen.

Any thoughts about when this enhancement will come into play? I suspect this will greatly enhance my perceived performance of startup.

Thanks!

scottnonnenberg-signal commented 6 years ago

@chucksense We generally don't talk about our future plans. But I can point to some big changes we are working on right now: https://github.com/signalapp/Signal-Desktop/releases/tag/v1.15.0-beta.7

deutrino commented 6 years ago

Needs "android change needed" flag, particularly if users are being told to open a bug for Android for this. All due respect, I think that approach is a great way to not get the contact-sync spam fixed for many more months, as somebody would have to go through the entire hassle of generating what is essentially a duplicate bug report, crossing every T and dotting every I, and then because it's a bug that doesn't impact performance on Android itself, who knows how long it will languish. Perhaps coordination between teams on your end is a better solution for this particular issue.

scottnonnenberg-signal commented 6 years ago

@deutrino There has been some coordination on our end, and a fix is in recent Android builds (though still beta-only at this point): https://github.com/signalapp/Signal-Android/commit/bf692e8da354d3bfd44fe85fb3abb3cadec5e857

leonardehrenfried commented 6 years ago

I'm on the Android Beta program and just upgraded to Signal Desktop 1.15.0 and the start up was almost instant! What great improvement!

Did 1.15.0 introduce something that caused this speed-up?

scottnonnenberg-signal commented 6 years ago

@leonardehrenfried It has very large changes in it, detailed here: https://github.com/signalapp/Signal-Desktop/releases/tag/v1.15.0

If you submit a debug log, we could take a look at how many messages were migrated to SQLCipher, etc. Anyway, please continue to let us know how v1.15.0 works for you.

leonardehrenfried commented 6 years ago

Here is my debug log: https://debuglogs.org/2492b4ec48858f51e36c3136f577c0be28d0abee7d5840ee49dafccfae54ca18

I can't speak for everyone but I consider this issue fixed. Thanks for the great work, @scottnonnenberg!

sivaraam commented 6 years ago

@deutrino There has been some coordination on our end, and a fix is in recent Android builds (though still beta-only at this point): signalapp/Signal-Android@bf692e8

I observe a huge speed-up too! That start-up was almost instant. This helps me share things quickly when I'm on desktop instead of staring at the "Loading messages ..." screen for a long time.

Though I have yet to test this after some activity on the device to test it works well in that case too.

sivaraam commented 6 years ago

That start-up was almost instant.

To add to this, I couldn't call it instant as it got stuck in the "Loading ..." message (not the old "Loading messages ..." screen) for some time. Though, it was a short delay and is trivial when compared to the long delays that were seen in previous versions.

Thanks for the awesome work! :bouquet: :tada:

ckujau commented 6 years ago

Running Signal 1.15.0-beta.5 on Linux, the loading screen stays for ~50 seconds (up until "Loading messages, 100 so far...") and only then the Signal main window appears. When run under strace(1) (and with --disable-gpu due to #2378) I noticed that ETIMEDOUT was returned quite often:

     58  = -1 EEXIST
    112  = -1 EINVAL
   1163  = -1 ENOENT
   3391  = -1 ETIMEDOUT
 128234  = -1 EAGAIN

....and ETIMEDOUT alone took 15 seconds of the whole startup:

R: EEXIST        0.005097
R: EINVAL        0.002054
R: ENOENT        0.032118
R: ETIMEDOUT    15.6613
R: EAGAIN        4.96944

I found Electron issue #9485 with similar messages, although Signal does not seem to hang during its usage, so I don't know how related that issue is to the long loading times described here.

On stdout the following repeats over and over again:

{"name":"log","hostname":"horus","pid":27708,"level":30,"msg":"Got sync message with our own profile key","time":"2018-08-06T05:07:49.661Z","v":0}
{"name":"log","hostname":"horus","pid":27708,"level":30,"msg":"contact sync","time":"2018-08-06T05:07:50.183Z","v":0}
{"name":"log","hostname":"horus","pid":27708,"level":30,"msg":"GET https://textsecure-service.whispersystems.org/v1/attachments/NNN","time":"2018-08-06T05:07:50.184Z","v":0}
{"name":"log","hostname":"horus","pid":27708,"level":30,"msg":"GET https://textsecure-service.whispersystems.org/v1/attachments/NNN 200 Success","time":"2018-08-06T05:07:51.081Z","v":0}
{"name":"log","hostname":"horus","pid":27708,"level":30,"msg":"GET https://whispersystems-textsecure-attachments.s3-accelerate.amazonaws.com/NNN?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20180806T050751Z&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=xxxFus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=xxx","time":"2018-08-06T05:07:51.082Z","v":0}
{"name":"log","hostname":"horus","pid":27708,"level":30,"msg":"GET https://whispersystems-textsecure-attachments.s3-accelerate.amazonaws.com/NNN?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20180806T050751Z&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Expires=3600&X-Amz-Credential=xxxFus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=sss 200 Success","time":"2018-08-06T05:07:51.871Z","v":0}

The full strace logs can be made available, if needed.

scottnonnenberg-signal commented 6 years ago

@ckujau What you're noticing is the 'contact sync flood' problem discussed above. It's downloading an attachment sent by your mobile device with all of your latest contact information. Are you on Android? What version?

ckujau commented 6 years ago

I have Signal 4.24.6 (beta) installed on a Sony XZs running Android 8.0.0 (07/2018 patch level).

But...why does it download the attachment over and over again? Once started, and closed again, the immediate next start again takes a very long time. But I guess this is what this bug is about ;)

scottnonnenberg-signal commented 6 years ago

@sivaraam Would love a debug log to see what that extra loading time is coming from.

joaobarcia commented 6 years ago

From my side, yesterday's update would get stuck on launch with an "optimizing messages" message.

Today's update seems to be working great! Haven't started app/rebooted often enough to 100% confirm fix, but seems to be fixed.

Happy to send the debug log if it's in any way helpful

sivaraam commented 6 years ago

@sivaraam Would love a debug log to see what that extra loading time is coming from.

I'll give them when I get back to my computer the next time. In the mean time, any pointers about how to get the logs would be useful.

From my side, yesterday's update would get stuck on launch with an "optimizing messages" message.

I did saw that optimizing messages screen too. It seems to be a one-off processing to handle the upgrade from previous versions, I suppose.

scottnonnenberg-signal commented 6 years ago

@sivaraam You can get your debug log at View -> Debug Log

GhostofGoes commented 6 years ago

Bug is back on my laptop. I'd like to share a log, but the settings button is hidden, and I can't un-hide it without accessing the settings...

scottnonnenberg-signal commented 6 years ago

@GhostofGoes You should be able to use the 'alt' key on Windows to show that menu if it's been hidden.

sivaraam commented 6 years ago

@sivaraam You can get your debug log at View -> Debug Log

May be I was prematurely excited. I'm seeing the "Loading Messages. ..." screen again :disappointed: This is on Signal for desktop version 1.15.0 (release). I use Signal for Android version 4.24.8

The desktop app also hanged a little on the "Loading .." screen. FWIW, the network was a little sluggish when the logs were taken.

https://debuglogs.org/9ce7e74688bf48c60add8c0be72eaadb9807399e531501ad0acdcaeb12f0c430

GhostofGoes commented 6 years ago

@scottnonnenberg Thank you! Here's the debug log of the latest slow load. Occurred a few minutes ago, when opening signal after rebooting my laptop.

scottnonnenberg-signal commented 6 years ago

@GhostofGoes Looking at your log, every time you start up Signal Desktop it at least 10 contact syncs right in a row. What mobile app (and version) is your Signal Desktop linked to? Older Android versions had problems sending contact syncs too often, more recent versions have scaled that back.

GhostofGoes commented 6 years ago

Android signal version 4.24.8, which is the latest available from the Google Play store as of last night. I tried disabling contacts a few weeks ago, didn't seem to make any difference.

Bomper commented 6 years ago

Loading v1.15.4 is fast. Thanks!

scottnonnenberg-signal commented 6 years ago

@GhostofGoes I just released v1.15.5 which fixes an issue where contact syncs would be continually reprocessed. Your next startup might still be slow, but startups after should get a bit faster.

GhostofGoes commented 6 years ago

@scottnonnenberg-signal Wow, startup is screamin' fast now! Thanks for the fix! 👍

dlitz commented 6 years ago

It's a lot faster for me on Linux desktop as well (v1.15.5). Thanks!

leonardehrenfried commented 6 years ago

I just opened Signal Desktop and was greeted with about 30 seconds of the "Loading 20 messages..." screen after only having used the Android (beta app) over the weekend.

30 seconds isn't too bad but I was wondering why the screen counted up to 620 messages, when I sent at most 100 (more like 50) Signal messages over the weekend. Even if it was 620 messages (mostly text, just a few images) shouldn't that be faster than the 30 seconds?

Here is my debug log: https://debuglogs.org/aa8f342f7761e09f63d76c81eefb7ec2630fb2894ea8133516072ed080eea13c

scottnonnenberg-signal commented 6 years ago

@leonardehrenfried Hey there - thanks for checking in and and providing your log. The messages we need to process can be substantially more than the messages you see in the app - for example, if you're in a large group, and you send a message to it, you'll get a delivery receipt message from each member. Your phone will also periodically send its complete set of contact information to your desktop, another invisible message type.

sivaraam commented 6 years ago

I upgraded to v1.15.5 and still see no improvements. I still get the Loading messages screen which takes a some time to complete. To make things worse, Signal Desktop seems to be requiring a lot of resources during initial startup. It just seems to be unresponsive for a few seconds and it went to an extent that the OS considered the application unresponsive and asked me whether to kill it or not.

I use Signal for Android's beta version (by signing up for the beta programme) on a Samsung Galaxy J1 Ace (Android 5.1.1) if that's worth noting.

Debug logs for Signal Desktop

Mushoz commented 6 years ago

What is the major difference between this Electron app and the Chrome extension app that Signal previously used as a desktop client? Because the latter always opened instantly (and still does). Were they designed differently?

scottnonnenberg-signal commented 6 years ago

@Mushoz The chrome app was always running in the background, whenever Chrome was running. Thus, it was always up to date, always downloading messages. That's the primary difference.

@sivaraam How long does that Loading screen take for you in clock time? And how high does the number of messages processed get?

butla commented 6 years ago

@scottnonnenberg Adding an option to start on boot could slightly mitigate that problem, right? Now the problem is that I want to message someone, I open Signal and I'm hit with the loading screen that ruins my experience.

Wouldn't it be possible to let people write new messages without waiting for the old ones first? Is loading messages gradually, starting from the newest ones (while a user is able to type new messages) possible? If the Chrome extension can load messages in the background, shouldn't the app be able to do the same?

scottnonnenberg-signal commented 6 years ago

@butla I would encourage you to read up-thread and in other performance-related issues in this repo to see the discussion about potential performance mitigations. There's a specific issue focused on getting rid of the loading screen.

sivaraam commented 6 years ago

@sivaraam How long does that Loading screen take for you in clock time?

The "Loading .." screen that comes before "Loading messages .." screen took ~30s. The "Loading messages .." screen took ~1m 30s to complete.

I suspect the timing is a bit high due to the fact that the network might have been a little sluggish. I feel that as I use a Wireless network and the speed isn't consistent, of course. Further the "Loading messages .." numbers increased slowly which added to my suspicion. fast.com reported a speed of 2.6Mbps around that time.

And how high does the number of messages processed get?

For a very low volume week (by which I mean I didn't send a lot of messages during the week), the number went upto 30.

ckujau commented 6 years ago

Signal v1.15.0-beta.5 on Linux (with Signal Beta 4.25.10 running on Android 8.1) starts much faster now, 15 seconds instead of 50, yay! Much joy, thank you for fixing this!

scottnonnenberg-signal commented 6 years ago

@ckujau Beta is now at v1.16.1-beta.1 - it has further performance enhancements.

ckujau commented 6 years ago

Yeah, I've seen that but that version is segfaulting here...and may be material for another report :)

scottnonnenberg-signal commented 6 years ago

@ckujau Yep that's a different bug. And if you installed it any other way than apt, you'll have to contact the person who maintains that package.

Sethur commented 5 years ago

I'm on Windows 10 with Signal Desktop v1.17.3 and loading times for the app are still far beyond acceptable. I use the app once every 2-3 days or so and everytime I start it up it takes more than half a minute, sometimes more than 3 minutes to load the messages. On the previous Chrome App, this was never and issue. I'm not sure what changed on the migration to Electron, but even though it is a known bloat-inducing framework, the performance drop could not have been that significant. There must be some remaining problems with the implementation.