-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Eliminate loading screen, load new messages in the background #1442
Comments
First, you can get the version information from the top of the debug log. Sadly, we have a bit of a problem implementing this today. We don't know how many messages are waiting for us in the queue on the server, so we don't know a massive torrent is coming. And today we have nothing attempting to detect full application sleep. So perhaps we can talk about the expected user experience. Would you be okay if the loading screen came back when we were able to detect that we had 20+ messages to pull down? Or would you like the UI to be changing real-time as you navigated around (unread counts going both up and down, new messages showing up unread, then being marked as read, etc.), just no notifications? |
I reckon if I were designing the experience, I'd probably do something like; when there is data to fetch from the server, fetch all of it in the background until it's fully synchronised. Then, now that all new messages are available locally, apply the UI update in one hit? Ie, all the new messages would appear in the UI at the same time.
It seems fetching from the signal server is surprisingly slow, so perhaps a piece of UI to indicate that a synchronisation is ongoing in the background would be a good hint to users that there is background activity and they should expect new messages to appear soon. Now the reason I suggest to maintain a usable UI even though there is pending background activity, is that the user may want to author+send new messages while the background sync is ongoing. I can't imagine why that would be impossible...? Is it possible to send a message immediately even if the client hasn't yet 'caught up'? If not, then the client should obviously take my authored message(/s) and send after sync has concluded. |
Frequently I'll try to send a message while the app is still synchronizing in the background. I will inadvertently send a message (current time) and then the previous messages from the contact will arrive on the desktop. This will create a situation where the newest sent message is displayed before the older messages from the contact. The sent message will only have 1 check mark, signifying it's been sent and not received. Most of the time I'll notice this and be unsure if the recipient has the message (due to some logic to prevent out of order messages on the Android?) and have to resend once everything is updated. Now my desktop and android message timelines have diverged and it's confusing for a short time until everything gets synced back up. |
I noted in the Chromium app that the syncing process is hidden behind the curtain when the machine has been off, but not when it has slept, as is noted above, but I wanted to clarify that bit. Either way it's annoying, and the biggest annoyance is the glacially slow speed. I was away from my computer for over a week using Signal the whole time on my phone, and it literally took nearly an hour to sync when I turned the computer back on. I know there are protocol limitations influencing this, but it's really not something that could be explained to 99% of users when every other messaging app Just Works in the same scenario. So if I were project manager, the absolute highest priority would be making the sync happen as quickly as possible. I don't know how to do that without leaking information - would the server volunteering "hey, there are 500 messages in the queue" be too much of a leak? - but hopefully it is possible. As far as UI, seeing the entire song and dance and hiding it behind the curtain are both bad. The former makes the desktop client difficult to use for the duration, and the latter makes it impossible to use. I suspect there aren't any easy solutions to this, but for now, it would be somewhat less unpleasant if messages sent AFTER the date of messages being received as part of a sync, would stay on the bottom of the scroll. |
This.
The latter makes it impossible to use under the assumption that the sync will take an hour... if the sync was 'fast' then it it's not a problem at all, or is there some other problem with the experience that I'm not thinking about? |
Apologies if this is duplicate info. I wanted to characterize the behavior I'm seeing in Electron a bit better. I'm a pretty heavy Signal user; between my contacts and the one messaging group I'm in, it's typical for me to exchange hundreds of messages per day. This is a major pain point for me. I'm experiencing the problem in this ticket 100% reproducibly on Electron. It is always glacially slow to sync a message backlog when the Electron client hasn't been running while the messages were exchanged on other devices. The UX varies depending on whether the client was shut down or running but with the computer asleep. If the client was shut down, the "loading messages" interstitial appears. If the client was running on a sleeping computer, the messages are replayed, generating huge numbers of notifications and making the app essentially unusable for messaging contacts for whom there is a backlog being replayed. This has a severe negative impact to the usability of the app during the replaying, which can take tens of minutes. STEPS TO REPRODUCE:
WHAT ACTUALLY HAPPENS: If Electron client was shut down:
If Electron client was running but computer was asleep:
WHAT I EXPECT TO HAPPEN (Please note, I know there are fairly fundamental issues behind this problem, I write these from the "it should Just Work™" user perspective.) A. The app should sync the entire backlog of messages in a reasonable time - I would pick 30 seconds as a goal to shoot for, because I suspect that users other than just myself will start to get more and more annoyed beyond about 30 seconds. Regarding "what I expect to happen," I understand there are protocol issues in the way of point A. If I understand correctly, part of this is that the desktop app doesn't have a way to know that the messages are part of a backlog, which makes points B and C quite difficult? Even implementing point C alone would be a considerable improvement - because Electron is popping up hundreds of notifications, the aggravation is leaking outside of the app itself and negatively impacting the usability of my entire computer. Anyway, hopefully a little more detail is helpful, let me know if there is any logging or testing I can help with. Thanks! |
I just had my laptop powered down for about 2 hours.
https://gist.github.com/deutrino/3e771ef1f00eec7a96a9bafe6ac2caee This is really, really bad. And not even remotely out of the ordinary for that volume of messages. Edit: Forgot to add, the signal-desktop process with the lower pid shows constant CPU usage the entire time, usually about 20-25% of a core. Also, I am starting to wonder more about #1495, I am a really heavy user so maybe that plays a part. |
@deutrino I took a look at your log, and there's a lot to digest. First, there are a bunch of these errors, which makes me wonder about the health of your database. How big is your
Those are all in the session right before the slow load you're talking about, but they do help set the context. Not long after the start of the slow startup in question, there was 30-second period where nothing was logged:
And from then on there is general slowness, which I have to imagine is due to some sort of database difficulty. Either that, or there's generally a lot of stuff going on in the process otherwise. You can see that there are only about five log entries per second after that. Might have something to do with all the This is an interesting section - the
I've got two competing theories: a) the database is starting to buckle under the weight of your usage, and b) You're a very heavy disappearing messages user, and that is contributing to database saturation or general event loop saturation. Some more information on your database size, and then some CPU profiles would be useful. You can open the devtools and collect a javascript profile during a slow startup, and that might help us understand things a little bit better. I'll also take a look at our expiring message handling. |
I have disappearing messages set to 1 week with almost all my contacts, including the ones I message a LOT. I don't have time to poke more at it right this second but here is some further system data. Also, the hard drive is glacially slow, but I looked and nothing was thrashing the disk while it was loading. I will probably have several opportunities in the next few days where my laptop will be offline while I am using Signal on Android, so hopefully I can gather more data.
|
I just renamed this issue to reflect its current meaning - the loading screen, shown on launch of the app, should be eliminated, and messages can be loaded in the background. |
@Lesik That assumes you are able to determine what subset of your contacts have messages needing to be sync'd. The signal server presents us with a simple queue of messages, and we don't know who they are from until we pull them down. |
@scottnonnenberg There seems to be a misunderstanding, my proposal does not require to know what contacts have new messages. I simply suggested that instead of a full-screen loading screen, the "Signal" text in the top-left corner to be replaced with "Syncing...", as other messengers do. Current UI: My proposal: |
@Lesik Thanks for the clarification. The standard problem arises, then, of sending a message in a conversation when there are pending incoming messages - things end up out of order. Perhaps the right tradeoff is the top-level notification you mention, then a popup if you try to send a message when that's showing. You can navigate and compose messages all you want... |
Thanks Scott for moving the discussion here. My question is on implementation level, why does it take that long to download & decipher the few hundreds (thousands) new messages on the sync? It could be what..a few MB, that's a matter of a minute max on any modern connection and hardware. So what is causing the slow-down we observe? Also, are the messages locally cached? To me it seems I download them all over each time Signal is restared. Other than that, as I understand it now, all the messages from any of the "linked devices" are kept on the OWS servers (hopefully end-to-end encrypted :) ) and waiting for the sync to the remaining linked device. Then they are deleted? What happens if the linked device never connects anymore, is there a EOL time? Is the server side infrastructure open-source as well? It would be nice to have an option in the app to "wipe all of my data from the servers"... |
@breznak - Remember, it's not just download. It's download, decrypt, and processing of each message. Including potentially large attachments, which then also need to be decrypted. Of course, that's not a complete explanation, because we could still do better. Here's the server source code: https://github.com/WhisperSystems/Signal-Server Regarding, 'wiping your data.' We don't believe it to be a high risk, because the messages are encrypted. Only from/to/timestamp is known to us. Most of the time there aren't many messages there anyway, because clients generally stay up to date, and there's a limit to the messages we save. But if you're concerned about it, you might consider unlinking a desktop client that you don't really use anymore. |
Even given all that work, it's still really really REALLY slow. To the point of, as discussed, tens of minutes or worse for a client that missed a couple hundred messages. What is the fundamental cause of that - a round trip for every message? The more people adopt the desktop app, the more this pain point is going to get noticed and become a black mark when people decide whether or not to recommend the app. |
@deutrino Please provide logs when things take a long time. It's very help for us to see what happens on machines other than our own. Digging a bit deeper, I think some of the undue delay is because of IndexedDB churn - we save to the database before we decrypt, then again, after we decrypt, then finally after we've fully processed the message. But I think our biggest opportunity for improvement here has to do with how we schedule all this work - for protocol reasons we need to decrypt in strict incoming order, but there are other things we can do outside that ordering - downloading attachments, and processing the messages on the application side. Once we break those up into separate queues, I think the whole process will go a lot faster. Note: I'm not far from locking this conversation, because I think we've covered all the bases. I really don't want to get into bunch of repeated "why is it so bad?" questions. Feel free to add emoji responses, of course - that helps us understand how important things are to y'all. |
Okay. I did provide logs back in November but will try to provide more as, having taken a glance back at that part of the thread, it looks like there was a bunch of unhelpful noise in those logs. As you know I'm a heavy user with a longstanding desktop install. I'll start from that baseline and then later if you need me to reinstall etc, I'm happy to do that - I'm traveling so turnaround time might be a bit slow but I have a major interest in helping to improve this any way I can. I can gather logs when waking my laptop from sleep with a running client, and/or when starting the client after it's been offline a while, let me know if you have any preference. I'd be happy to move this to a separate issue, whatever works for you. I have a major interest in seeing improvements to this sync process and would have helped more already, it's just the usual herding of cats problem for me :) |
See also: #2733 |
it's a lot faster now for some reason, even though i had my laptop turned off. |
@imrekalo Glad to hear you've seen an improvement. Is that a change that came along with the Also, in the future, please include a debug log whenever reporting performance issues (or really any issue!). |
@scottnonnenberg-signal i shouldn't have counted my chickens before they were hatched... tonight my desktop app had to load more than a few messages and it took very long to sync, with signal desktop being unresponsive and cpu running around 90%. when it was responding, i could see that it takes the conversations one after the other and updates them, the messages coming in very slowly. here is the debug log: https://pastebin.com/J7TvtBJq please let me do if there's anything i can do, test, whatever. i'm eager to help. |
is it possible to transfer messages from mobile client using LAN connection, not from servers? It would be so much faster, and could be also encrypted If my phone is on 192.168.1.101, and PC on 192.168.1.102, why Signal Desktop must download it from servers? |
A local discovery service and if it doesn't find the partner, it would speak with the server. :) |
Pretty sure not the downloading part is time intensive but the decryption is |
It depends on your CPU, SSD/HDD, Motherboard and Internet speed. |
How about syncing in the background and updating UI (adding/removing messages) as new information is received? |
Still waiting for this shit to load up, after finishing this whole thread, lol |
As far as I have understood it, it's because the encryption works by chaining messages together. So if you have very long message threads it takes forever to decrypt everything from the beginning of time until the present. And if you only casually open your Signal Desktop from time to time you'll always have to wait until it takes so long you'll just grab your phone anyway. And they'll tell you that it's not a bug but a feature. smh |
I'm still having this issue with 1.25.1. The average CPU load of signal-desktop is less than 20%, and overall my computer is 65% idle. I have gigabit fiber connection to internet, and only some (30-ish, maybe 5 images) messages since last time I started signal desktop. After 5 minutes only 150 messages were loaded (it seems more messages than only the new ones), with a throughput of loading about 30 messages per minute. I of course do not know the technical details of the protocol, but it looks to me that some improvements should be possible. |
Same issue, here's more datapoints if you want. v1.25.1 Linux, running on Chrome OS, Slate tablet (beta channel 75.0.3770.61, with keyboard) using the standard upstream Linux container and the official Linux install docs for Ubuntu/Debian. Debug log from a few minutes after startup. As a vote in favor of dumping electron in favor of ANYTHING else, its also using a significant amount of memory just idling along. Freshly launched it is over a gig resident, and by the time it has been up a few days it starts to push everything out of ram until it is restarted (at the huge battery/time cost of the startup sync.) And that hits on my osx client as well :( |
Same with 1.25.2 on Arch Linux. Loading took 10 minutes. |
Using v1.25.3 on Fedora Linux, I had to change the group to only load 1 week's worth of messages. It still takes a lot longer than say Telegram or other desktop chats. I've gotten to the point where I start it in the morning and go do other things. |
When you're designing an application and selecting a platform for it, if your choice falls on Electron you've made a huge mistake or missed something along the way. Electron is always the wrong choice, unless you want to build a Chrome flavoured web browser. |
Yes, my experience as developer is that electron doesn't give you the performance and the resource usage you need. |
Here is the log file. Yes, it is improved. But the normal bar of "starting IM app" is higher. |
Slow Startup not only a problem of speed -> loosing messages #3636 |
Another user here with continuous, long, slow startups and laggy interface due to Electron. However, if I disconnect my internet, start Signal, and then reconnect, startup is magically speedy. v1.27.4 debuglogs Please drop electron. Qt Quick or even Java Swing or Java FX for cross-platform use would be preferable. As for the slow loading messages, the mobile apps don't have such a slow startup, so why does the desktop app? Maybe it's possible to replicate what they're doing on desktop. |
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. |
Bug description
I sleep my computer when it's off.
I often wake my computer from sleep, and then Signal plays catch-up with all the activity from my phone or other clients.
Every single message received while my computer was asleep shows a pop-up notification, and makes the new-message 'ding-a-ling' noise.
Today, I have hundreds in the catch-up queue. I've been sitting here for over 5 minutes so far just hearing my computer ding and spamming notifications about messages I received the last couple of days.
Does this happen if my computer is off rather than asleep? I can imagine perhaps, since the client was launched before the messages were received, that when I wake the computer, it thinks the messages were received during this active session?
Steps to reproduce
Actual result: Torrent of catch-up activity; very annoying
Expected result: Signal should know my computer was off, and not give me notifications that have already been read on other devices.
Platform info
Operating System: Win10 64
Browser: Electron
Signal version: [...where is the version information on the electron client?]
The text was updated successfully, but these errors were encountered: